« Archos Jukebox Upgrade | Main | New iPods »

Saturday September 5, 2009

Cleaning Up Playlist Files

I'm loading up the Archos now that it has a super big hard drive and can hold all of my music. I keep singles in a file called @Downloads. The @ is so that it sorts to the top of the list. But the Archos doesn't automatically play everything in a folder (I think Rockbox has a preference where it will do that, but that's not what I want to do anywhere else). So I opened a song in Windows Media Player which is my default MP3 player on my laptop. Then I drag all of the songs in the folder into that window. Now I have a list of all the songs. Then there is a Now Playing drop-down list where I can choose "Shuffle List Now". Then from that same list I can choose "Save List As" and then change the type to m3u instead of WMP's default.

Now I have a shuffled playlist. This is better than just regular shuffling because regular shuffling will repeat songs. The playlist it creates has all of these extra lines in it that start with #EXTINF. I'm not sure exactly what those do, but I think they help generate all of the song info faster. WinAmp playlists are the same way.

I did a search for how to strip out the EXTINF lines and found a guy who knows way too much about DOS. He said that you should start a command window (Start:Run and type cmd is the fastest) then navigate to the folder you want to go to and type in the following magical line where +clean.m3u is the name of the playlist without the extra lines in it:

findstr /i /b /V "#EXTINF" "+downloads.m3u" > "+clean.m3u"

This is pretty good, but I still had a bunch of blank lines (I could probably get rid of them by modifying the command above, but I don't know how to do that). So I opened the new file in Notepad, copied everything, pasted it into a blank Word document, and searched for ^p^p and replaced it with ^p. Then I selected all, copied, and pasted it back into the Notepad file. Finally, just delete the downloads.m3u file and rename clean.m3u.

Here is what the switches mean:

/i Case insensitive
/b Match text at the beginning of the line
/V Print only lines that do not match the pattern

Then you do the file name to look in and then type > and the output file, otherwise it will just print it to the screen.

Later I found out how to strip blank lines from a text file:

findstr /v "^$" "+clean.m3u" > "+downloads.m3u"

Now all you have to do is delete +clean.m3u since the original +downloads.m3u will be overwritten by this second command. Apparently ^ is the shortcut for beginning of line and $ is a shortcut for the end of a line, so an entire blank line is ^$.


Post a comment