Campfire Songbook Builder is a Python-based application designed to generate songbooks with lyrics and chords for campfire sing-alongs. It fetches song lyrics from Genius and chords from Chordie or Ultimate Guitar, processes them, and generates a formatted document.
- Fetch song lyrics and chords from online sources.
- Cache lyrics and chords to minimize repeated API calls.
- Generate formatted documents with lyrics and chords.
- Command-line interface for various operations.
- Python 3.8+
- Access to Genius API (requires a client access token)
-
Clone the repository:
git clone https://github.com/yourusername/CampfireSongbookBuilder.git cd CampfireSongbookBuilder -
Create a virtual environment and activate it:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the required packages:
pip install -r requirements.txt
-
Set up the directory structure:
mkdir -p data/config data/output # On Windows use `@("data/config", "data/output") | ForEach-Object { New-Item -ItemType Directory -Path $_ -Force }` -
Copy the example config and fill in your Genius API credentials:
cp data/config/config.example.json data/config/config.json # Then edit data/config/config.json and add your Genius API tokenExample config:
{ "genius": { "client_access_token": "your_genius_client_access_token" } } -
Place your song list in
data/src/CampfireSongs.csv. The CSV file should have the following columns:Artist,Title, and optionallySkip.
Run the application from the command line with various options:
-
To get song titles and character lengths of the lyrics:
python main.py --get-song-info
-
To generate a document with lyrics only:
python main.py --lyrics-only
-
To generate a document with chords only:
python main.py --chords-only
-
To generate documents from the cache:
python main.py --generate-from-cache
A minimal test and linter configuration is provided for code quality:
- To run tests (after adding tests to the
tests/directory):python -m unittest discover tests
- To check code style with flake8:
flake8 app/ main.py
CampfireSongbookBuilder/
│
├── app/
│ ├── __init__.py
│ ├── cache.py
│ ├── document_creation.py
│ ├── document_formatting.py
│ ├── document_generation.py
│ ├── fetch_data.py
│ ├── song_info.py
│ └── text_cleaning.py
│
├── data/
│ ├── config/
│ │ ├── config.example.json
│ │ └── config.json
│ ├── src/
│ │ └── CampfireSongs.csv
│ ├── cache/
│ │ ├── lyrics_cache.json
│ │ └── chords_cache.json
│ └── output/
│ ├── Lyrics_Document.docx
│ └── Chords_Document.docx
│
├── main.py
├── README.md
└── requirements.txt
Feel free to submit issues and pull requests. For major changes, please open an issue first to discuss what you would like to change.
This project is licensed under the MIT License.