Jacob Peddicord

Sneaky Songs

July 09, 2010 at 11:05 PM | categories: Random, Planet Ubuntu | View Comments

I'm going on vacation (OBX!) in a week, and figured I should probably update my music player (a Sansa Fuze) for the 12-hour ride there. I've had most of it sync'd for a while, but then I noticed that a few songs were missing ReplayGain tags. Oh no! (ReplayGain ensures everything plays at the same volume so your ears don't bleed when switching songs.)

So, there were a few options:

  1. Erase the player and re-sync 3.5 GB of songs.
  2. rsync the changed songs after adding ReplayGain tags
  3. Find which songs on the player were missing ReplayGain tags

The first option isn't very nice on the flash memory, and I figured there was a smarter way to go about things.

The second would have been viable if Banshee hadn't been updating playcount tags in the files, so almost everything had changed anyway.

So I dove into the third. Installed tagtool and started dumping some files. Those with ReplayGain had "REPLAYGAIN" in the output. Easy enough. It took some time, but I came up with the following command:

find . -name "*.ogg" -print -exec sh -c "tagtool --dump \"{}\" | grep -L REPLAYGAIN" \;

It looks through all ogg files (might work for MP3 too), sends them to tagtool, and then checks the output for a lack of "REPLAYGAIN" in which case it prints "(standard input)" after the filename.

So I ran this, sent it to a file, and scanned it for "standard input." Found about 20 songs. Deleted them off of the player, had Banshee re-sync, and things were back to being awesome.

Now I know what you're saying: "Why not just use Banshee's search bar?" Yes, Banshee's search is quite powerful, but unfortunately you cannot yet search by raw tag or replaygain.

/me scurries off to bugzilla

*Edit: Bug 624000. Nice number!*

blog comments powered by Disqus
Feed Contact Google+ Twitter LinkedIn GitHub identi.ca OpenID Launchpad