scrobble 0.1
Picture this.1
It’s been a long day. A long week even? You’ve earned your government salary and then some. It’s you time.
You head to your favorite chair and you think “ah what I would love right now is to pick a CD from this shelf here, slip that baby out of its jewel case2, pop it into this player, put my feet up and listen to the album from start to finish.”
Suddenly, though, an irk. A perturbance in the vibe. Something isn’t right. Then you see it. Your CD player won’t scrobble your album to Last.fm. There will exist no record of this experience, no entry in a NoSQL key-value database maintained by a hardly-changing music tracker owned by a massive media conglomerate to be used to train machine learning models that in the end won’t work all that well.3
Is this you? Because this is me. This was me. And to de-irk myself, I did what any person who is large and in charge would do. I created a Python library.
OK we’ve had our fun. Let’s get serious for a second.
This is for a niche audience, there’s no denying it. The problem I wanted to solve is I’m one of those people who are very attached to their Last.fm profiles, one of those “scrobbled or it didn’t happen” crowd, but I also like to collect CDs and listen to them. Yes you can rip the CD and play the files in a player that will scrobble to Last.fm, and that’s what I do a lot of the time. But I love the ritual of taking a CD out of its case and putting it into a dedicated player, and flipping through the booklet/liner notes while I listen to it from start to finish.
The problem is CD players are dumb machines (meant in the most flattering way possible) that do not have network interfaces or fancy firmwares (again, that’s a good thing). They won’t scrobble. They won’t even know what album or tracks they’re playing unless the CD has CD-Text (rare).
I’m not the first person to try and solve this problem. Daniel Puscher built CodeScrobble (GitHub link), a clever web app that uses the camera to scan the barcode on your CD or vinyl case, matches that to an album, and scrobbles the tracks (with correctly backdated timestamps) to your Last.fm account. There also exists OpenScrobbler created by Enrico Lamperti, which lets you search for and scrobble releases manually.
Unfortunately neither worked well enough for me. With CodeScrobble I had too many instances where the camera would freeze, frames would lag, or it would just not read the barcode. OpenScrobbler worked a little better, but searching manually was tedious, and sometimes search results are messy or miss the specific release I’m looking for.
pip install scrobble
So for fun, I built scrobble
, a small Python library that takes a barcode text, looks up the release on MusicBrainz, and scrobbles your tracks to your Last.fm account. Since barcodes can match more than one release with different tracklists, scrobble
will ask you to choose a release if that happens (unless you tell it not to). You can also back (or future) date your scrobbles if you are logging an album that you listened to earlier in the day, or just started listening to now.
~ scrobble --help
Usage: scrobble [OPTIONS] BARCODE [PLAYBACKEND]
╭─ Arguments ────────────────────────────────────────────────────────────────────────╮
│ * barcode TEXT Barcode of the CD you want to scrobble. │
│ Double album releases are supported. │
│ [default: None] │
│ [required] │
│ playbackend [PLAYBACKEND] When did you finish listening? e.g., 'now' or │
│ '1 hour ago'. │
│ [default: now] │
╰────────────────────────────────────────────────────────────────────────────────────╯
╭─ Options ──────────────────────────────────────────────────────────────────────────╮
│ --dryrun --no-dryrun --dryrun will print a list of tracks │
│ without scrobbling to Last.fm │
│ [default: no-dryrun] │
│ --verbose --no-verbose --verbose will print a bunch of stuff to │
│ your terminal. │
│ [default: no-verbose] │
│ --notify --no-notify --notify will send a push notification │
│ via Pushover with CD information. │
│ [default: no-notify] │
│ --choice --no-choice --choice will give you a list of options │
│ of more than one CD is matched. │
│ Otherwise, the app will go with the │
│ first match. │
│ [default: choice] │
│ --install-completion Install completion for the current │
│ shell. │
│ --show-completion Show completion for the current shell, │
│ to copy it or customize the │
│ installation. │
│ --help Show this message and exit. │
╰────────────────────────────────────────────────────────────────────────────────────╯
~ scrobble --no-choice --verbose 093624966524
💿 The Dead Weather - Sea of Cowards (2010)
🎵 1 Blue Blood Blues
🎵 2 Hustle and Cuss
🎵 3 The Difference Between Us
🎵 4 I’m Mad
🎵 5 Die by the Drop
🎵 6 I Can’t Hear You
🎵 7 Gasoline
🎵 8 No Horse
🎵 9 Looking at the Invisible Man
🎵 10 Jawbreaker
🎵 11 Old Mary
See the GitHub README for more information. Contributions welcome (I want to support other sources besides MusicBrainz, like Discogs, Bandcamp, etc.) Drop me a line if you have thoughts.
A note on usability
Now look here. I am happier in a terminal than a pig in a nice yard.4 But even I don’t want to have to fire up a shell as I sit in a chair listening to music. So, the way I actually use this tool is using an iOS shortcut that will either try to OCR an image of the barcode or prompt me to enter it manually and then ssh into a host and run scrobble with the barcode as an argument. It… works?
What’s missing is a proper barcode scanner. The OCR piece helps but it always requires manual correction. Problem is I can’t find a barcode scanner with a Shortcuts component on the App Store that doesn’t sketch the hell out of me. Do you know of one? You know what to do.
🖤