Scrapes DJ Orion's weekly Friday playlist from djorion.fi and scrobbles the tracks to your Last.fm account.
- Parses "Artist – Title" lines (handles
-,–,—,:separators with spaces) - Filters promo/social/navigation lines
- Handles multi-line "K – System" style artist name splits
- Distributes scrobble timestamps evenly across a 20:00–22:00 Helsinki window
- Tracks processed dates to avoid duplicate scrobbles
--dry-runand--debugmodes for safe testing
python3
requests
beautifulsoup4
pylast>=5.2
Install dependencies:
pip install requests beautifulsoup4 pylastRegister at last.fm/api/account/create. You need:
API KeyShared Secret
export LASTFM_API_KEY=your_api_key
export LASTFM_API_SECRET=your_api_secret
./get_session_key.py --open --pollThis opens your browser, waits for you to click Allow, then saves the session key to ~/.session_key.
Add to your shell profile (~/.bashrc, ~/.zshrc, etc.):
export LASTFM_API_KEY=your_api_key
export LASTFM_API_SECRET=your_api_secret
export LASTFM_SESSION_KEY=$(cat ~/.session_key)# Scrobble the next unprocessed playlist
./orion_scrobbler.py
# Scrobble a specific date
./orion_scrobbler.py --date 14.11.2025
# Preview what would be scrobbled (no Last.fm calls)
./orion_scrobbler.py --dry-run
# Preview a specific date
./orion_scrobbler.py --dry-run --date 14.11.2025
# Always pick the newest post, ignoring processed-state
./orion_scrobbler.py --latest
# List available playlist posts
./orion_scrobbler.py --list
# Debug: show raw scraped lines
./orion_scrobbler.py --dump-raw --date 14.11.2025
# Debug: show only track-candidate lines
./orion_scrobbler.py --dump-candidates --date 14.11.2025
# Verbose diagnostics
./orion_scrobbler.py --debug --dry-runProcessed dates are stored in ~/.orion_scrobbler_state.json as DD.MM.YYYY (up to 80 entries). Delete or edit this file to re-scrobble a date.
If you don't use a session key, you can authenticate with username + password hash (not recommended):
export LASTFM_USER=your_username
export LASTFM_PASSWORD=your_password| Flag | Description |
|---|---|
--open |
Open the auth URL in your browser automatically |
--poll |
Auto-poll until you approve in the browser |
--token TOKEN |
Provide the token manually from the URL bar |
--save PATH |
Save to a custom path (default: ~/.session_key) |