Makes an ICS calendar with concerts of your favorite artists
- Python 100%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| config.yaml.example | ||
| gigs-calendar.service | ||
| gigs-calendar.timer | ||
| gigs.py | ||
| LICENSE | ||
| README.md | ||
Gigs Calendar Generator
This script fetches your top artists from Last.fm or ListenBrainz and creates an ICS calendar with their upcoming concerts in specified countries using the BandsInTown API.
Installation
Ubuntu/Debian
sudo apt install python3 python3-yaml python3-requests
Arch Linux
sudo pacman -S python python-pip python-yaml python-requests
Configuration
- Copy the example config file:
cp config.yaml.example config.yaml
- Edit
config.yamland set up either Last.fm or ListenBrainz:
For Last.fm:
- Get your API key from https://www.last.fm/api/account/create
- Set
service: "lastfm" - Fill in your username and API key
For ListenBrainz:
- Get your user token from https://listenbrainz.org/profile/
- Set
service: "listenbrainz" - Fill in your username and token
- Adjust other settings as needed:
- Change the list of countries to monitor
- Modify the number of top artists to fetch
- Set the time range for top artists stats
- Configure the output calendar filename
Manual Usage
python3 gigs.py
Or with a custom config file:
python3 gigs.py --config /path/to/config.yaml
Automated Updates with Systemd
- Create the systemd service and timer files:
Create /etc/systemd/system/gigs-calendar.service:
[Unit]
Description=Update gigs calendar with upcoming concerts
After=network-online.target
Wants=network-online.target
[Service]
Type=oneshot
# Replace with your username and installation path
User=your_username
WorkingDirectory=/home/your_username/projects/gigs
ExecStart=/usr/bin/python3 /home/your_username/projects/gigs/gigs.py
[Install]
WantedBy=multi-user.target
Create /etc/systemd/system/gigs-calendar.timer:
[Unit]
Description=Update gigs calendar weekly
[Timer]
OnCalendar=weekly
Persistent=true
[Install]
WantedBy=timers.target
- Enable and start the timer:
sudo systemctl enable gigs-calendar.timer
sudo systemctl start gigs-calendar.timer
- Verify the timer is active:
systemctl list-timers gigs-calendar.timer
Notes
- The script will only include future events in the calendar
- Concert data is fetched from BandsInTown with a delay between requests to avoid rate limiting
- The calendar file is overwritten each time the script runs, adding new events and removing past ones
- If you want to change the update frequency, edit the
OnCalendarvalue in the timer file- Example values:
daily,weekly,monthly,Mon *-*-* 00:00:00 - See
man systemd.timefor more timing options
- Example values: