2

I recently switched from windows to linux and the player I was using in windows stored the rating for flac files inside an id3v2 files which clementine, my preferred linux media player, cannot read. I'd like to create a big playlist in one of these formats: m3u, xspf, pls, asx, asx/ini, cue that I can import and manually set the ratings (in bulk). The files I have are the result of find on music files where grep finds "rating=x" or "Rating.x" inside the file.

ETA: The input text file looks like this:

./The Future Sound of London/The Isness/11 - Meadows.flac
./The Velvet Underground/The Velvet Underground/04 - Pale Blue Eyes.flac
./The Velvet Underground/The Velvet Underground/09 - The Murder Mystery.flac
./The Velvet Underground/The Velvet Underground/10 - After Hours.flac
./Sheryl Crow/C'mon, C'mon/02 - Soak Up The Sun.flac
./Sheryl Crow/Tuesday Night Music Club/11 - I Shall Believe.flac
./Sheryl Crow/Tuesday Night Music Club/07 - No One Said It Would Be Easy.flac
4
  • 1
    Your question boils down to manipulation of text files. Please edit your question and post an example of your input file list and your desired output format. Just make a test playlist and post it's contents here so we can know what the format is like. By the way, what makes you think that clementine cannot read id3v2? It can, so perhaps the ratings are not in the tags but in an internal database stored by your old player.
    – terdon
    Commented Oct 22, 2013 at 16:35
  • There are a few different standards for the output and I don't know enough about the required meta information to know which to give (which is why I listed all of the alternatives). Also, I know that clementine cannot read id3v2 tags from flac because this is no standard tag for rating a flac, nor is id3v2 a standard flag type for flac files. Adding support for this is a somewhat debated topic on the clementine forums, but it doesn't seem to have been implemented. I added sample from one of the input text files. Commented Oct 22, 2013 at 16:47
  • Ah, flac, OK, I thought you meant it cannot read id3v2 at all. OK, the playlist is going to need absolute paths, not relative ones like you have posted, could you also show the find/grep command you used? Where is your music stored? In ~/Music? Any of the playlist formats should be fine since they just point the player to the location of the files. Just pick a format and post a minimal playlist, that way I can write a little script that can create a file of that format.
    – terdon
    Commented Oct 22, 2013 at 16:55
  • Nevermind. I figured it out while reading through the documentation on the m3u standard. Commented Oct 22, 2013 at 17:11

1 Answer 1

2

You can turn this kind of relative path into an m3u playlist by simply adding the following line to the top of the file (and giving it a .m3u extension).

#EXTM3U

More information on wikipedia.

For reference, this is the first few lines of the new file.

#EXTM3U

./Plain White T's/Every Second Counts/13 - Hey There Delilah.flac
./The Police/Every Breath You Take- The Singles/07 - Every Little Thing She Does Is  Magic.flac
./The Police/Every Breath You Take- The Singles/10 - Every Breath You Take.flac
./The Police/Every Breath You Take- The Singles/11 - King Of Pain.flac
./Roger Waters/Amused to Death/11 - Watching TV.flac

For future reference, here's something you could run from the command line to generate playlists with tags that look like "rating=1" or something similar.

for i in {1..5}; do printf "#EXTM3U\n" > ${i}star.m3u; find . -type f -exec grep -i -l --text "rating.$i" '{}' \; >> ${i}star.m3u; done
2
  • Nice, +1. And it has no problems with spaces in file names or strange characters?
    – terdon
    Commented Oct 22, 2013 at 17:18
  • It didn't have any problems with spaces and it also got songs in my Håkon Austbø folder, which probably has the weirdest characters in the name. Commented Oct 22, 2013 at 17:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .