24x7 scraper for the Austria First now_playing API endpoint.
- logs only on track changes (no duplicates while the same song is playing)
- append-only log with local time (Europe/Vienna)
- SQLite database with all plays in UTC (safe for analysis)
- designed to run under systemd
Run:
sudo apt-get update && sudo apt-get install -y python3 sqlite3
sudo install -d -m 0755 /opt/atfirst /var/lib/atfirst /var/log/atfirst
sudo install -m 0755 atfirst-scraper.py /opt/atfirst/atfirst-scraper.py
sudo install -m 0644 systemd/atfirst-playlist.service /etc/systemd/system/atfirst-playlist.service
sudo systemctl daemon-reload
sudo systemctl enable --now atfirst-playlist.service
sqlite3 /var/lib/atfirst/now_playing.sqlite3 < sql/views.sql
Logs:
/var/log/atfirst/now_playing.log
/var/log/atfirst/now_playing.err
Database:
/var/lib/atfirst/now_playing.sqlite3
Top 20 tracks:
sqlite3 /var/lib/atfirst/now_playing.sqlite3 \
"SELECT COALESCE(artist,''), COALESCE(title,''), plays FROM track_play_counts ORDER BY plays DESC LIMIT 20;"
Last 50 plays:
sqlite3 /var/lib/atfirst/now_playing.sqlite3 \
"SELECT played_at_utc, COALESCE(artist,''), COALESCE(title,'') FROM plays_enriched ORDER BY play_id DESC LIMIT 50;"