scrobble is a small Python library and command line tool I wrote for:

  1. Last.fm users
  2. who still collect and play CDs
  3. and who know their way around a command line

So, yeah, it’s niche, but I use it every day!

I just added a couple of small features worth mentioning for posterity.

Barcode scanning

The first version of scrobble required you to enter the CD barcode yourself. This was fine. I mean, I lived with it. But obviously it’s a pain in the ass to type out that long number, especially on a smartphone screen.1 I tried to hack my way around that by using the iOS Shortcuts OCR action to process an image and detect the numbers, but I always had to fix the result before submitting. Obviously the tool needed a proper barcode scanner.

This turned out to be very easy to do, I just had to use the barcode.BarcodeDetector class from opencv-python.

So now you can take a photo of the back of your CD case and pass the path to that image. e.g.:

scrobble cd --verbose ~/IMG_1234.jpg

If you’re thinking it seems like a pain to take a photo, save that somewhere, and pass the path to that to a command, consider that iOS Shortcuts is still the primary way at least I use this tool.

Choosing which tracks to scrobble

I didn’t expect this to be something I would need, but I realized it was when I listened to my copy of MF DOOM’s MM..FOOD.2

My copy of the album is a double disc release with one audio disc holding all the tracks and the other an extras DVD-Video. The MusicBrainz release represents the DVD with a single 1:04:19 track called “MM..FOOD Drive Tour”. Well, that’s nice, but I don’t want an hour long track I never listened to being scrobbled.

So scrobble has a new --track-choice flag that lets you choose which tracks from the release to scrobble. Right now the feature requires charmbracelet/gum to be installed, and the experience of using it is very cool.

This feature is also useful when you can’t listen to an entire album in one sitting. I try not to let that happen, but it happens, and when it does it feels “wrong” to have the whole album scrobbled at once without gaps.

Up Next

scrobble is pretty simple and it’s built on the shoulders of people who did real work, like the authors of musicbrainzngs , pyLast, and the other dependencies the tool has.

Here’s another problem to solve. Believe it or not, some CDs don’t have barcodes. Sorry to tear the fabric of your reality like that, but it’s true. What do you do if you own a copy of the US release of Vol. 9 & 10 by The Desert Sessions and you look at the back and find no barcode?

It would be nice to be able to pass a url to a Discogs or a MusicBrainz page and scrobble the tracks from there. Maybe Last.fm album pages too? We’ll see.

  1. ~90% of my use of scrobble is via an iOS Shortcut. A topic for another post. ↩︎

  2. Just remember all caps when you spell the man name. ↩︎