Thursday, February 7, 2013

m3u making and other fun goodies.

2 Posts today..

I did a run with Zombies Run today, it's super fun! But I was thinking about how to make a good playlist with linux, easily...  I haven't tried combining it all yet but I bet I could... anyway .. here's what I do:

With rhythmbox, I make a playlist, then save it as a m3u file - this gives me a file that links all my mp3s on them. Put this file in a directory, then run this at command line:

sed "s/#.*//g" < playlist.m3u | sed "/^$/d" | while read line; do cp "${line}" '/path/to/output/folder/'; done
 
 From this question:
http://askubuntu.com/questions/43643/how-can-i-export-all-the-mp3s-from-a-playlist-in-banshee

Then, once you've gotten all the files in a directory, you need to make a new m3u which removes the paths and just lists the files in the directory... so make a bash file.. like "makem3u.sh" and put this in it:

#!/bin/bash
#
#
touch ./playlist.m3u
echo "#EXTM3U" >> ./playlist.m3u;
for MUSIC in *.mp3 ; do
echo "#EXTINF:"$(mp3info -p "%S,%t" "$MUSIC")"
"$MUSIC"" >> ./playlist.m3u
done

chmod +x the file (or right click it and choose "make executable")
now just run this bash file: ./makem3u.sh

now you have a directory with all your mp3s and an m3u file that links them all. Drop the directory onto your phone or sd-card and let it scan and now zombies run can use it!

tough but it works! :)

No comments: