!/bin/bash # # make-ogg-playlist v0.1 (By Sam Storie) # # Changelog: # v0.1 Initial Creation # # # This creates a series of XMMS playlist files # from an ogg library that is organized like: # # /home/sam/music # +- Radiohead # +- Paranoid_Android # | +- Track1.ogg # | +- Track2.ogg # +- Hail_to_the_Theif # +- Track1.ogg # +- Track2.ogg # # and creates these files: # .../music/all.pls (all oggs) # .../music/Radiohead.pls (from Radiohead) # ../music/Radiohead/Paranoid_Android.pls (that album only) # .../music/Radiohead/Hail_to_the_Theif.pls (that album only) # # Needs to be full path (ie, ~/music won't work) ROOT=/home/sam/music cd $ROOT BuildPlaylist() { ct=1 NUM=$(find $1 -type f -name *.ogg | wc -l | awk '{print $1}') echo "[playlist]" > $2.pls echo "NumberOfEntries=$NUM" >> $2.pls for i in `find $1* -type f -name *.ogg`; do echo "File${ct}=${ROOT}/${i}" >> $2.pls ct=`expr $ct + 1` done } # Do all the subdirectories for j in `find * -type d -maxdepth 1`; do BuildPlaylist $j $j done # Make a list for all of them BuildPlaylist "" "all"