So I have a Linux server with all of my mp3s. I want to beable to have a script that will create an updated winamp playlist every 5 hours. There is no real pracitlcal reason right now for me to create a new one every 5 hours since I rarely get new mp3s. The reason why I'm really doing this is because my Linux professor wants us to create a Linux script that does something every so often and have it run in the background and also have it start on startup.
So anway, in a winamp generated playlist files that are queued over a network look like this:
\\Tachikoma\Music\Anime\Ghost in the Shell\Innocence OST (320CBR)\GitS Innocence - 07 - Kugutsuuta aratayo ni kamutsudo hite.mp3
\\Tachikoma\Music\Anime\Ghost in the Shell\Innocence OST (320CBR)\GitS Innocence - 08 - The Doll House I.mp3
\\Tachikoma\Music\Anime\Ghost in the Shell\Innocence OST (320CBR)\GitS Innocence - 09 - The Doll House II.mp3
\\Tachikoma\Music\Anime\Ghost in the Shell\Innocence OST (320CBR)\GitS Innocence - 10 - Kugutsuuta kagirohi ha yomi ni mata muto.mp3
\\Tachikoma\Music\Anime\Ghost in the Shell\Innocence OST (320CBR)\GitS Innocence - 11 - Tohokami emi tame.mp3
\\Tachikoma\Music\Anime\Ghost in the Shell\Innocence OST (320CBR)\GitS Innocence - 12 - Follow Me.mp3
\\Tachikoma\Music\Rock\Godsmack - Awake.mp3
\\Tachikoma\Music\Rock\Godsmack - Get Up, Get Out.mp3
\\Tachikoma\Music\Rock\Godsmack - Voodoo.mp3
\\Tachikoma\Music\Rock\Godsmack - Whatever.mp3
\\Tachikoma\Music\Alternative\Goo Goo Dolls - Big Machine.mp3
\\Tachikoma\Music\Rock\Foo Fighters - Big Me.mp3
\\Tachikoma\Music\Rock\Foo Fighters - Everlong.MP3
\\Tachikoma\Music\Rock\Foo Fighters - Learn To Fly.mp3
\\Tachikoma\Music\Rock\Foo Fighters - Monkey Wrench.mp3
\\Tachikoma\Music\Rock\Foo Fighters - My Hero.mp3
\\Tachikoma\Music\Rock\Foo Fighters - Stacked Actors.mp3
\\Tachikoma\Music\Rock\Foo Fighters - Times Like These (Acoustic).mp3
Here's my script that will find all the mp3s on the server, put them into a file and then repeat every 5 hours:
#!/bin/bash
#
# Script will compile a list of all the mp3s in the sub directories and
# then compile a new winamp play list.
exec 1> mp3_list
while [ 1 eq 1]
do
set `date`
# Output list of mp3 files on server into a file.
find -iregex .*\.mp3 -fprintf mp3_list.$2.$3.$6 \\\\\\\\Tachikoma\\\\%P\\n
# Wait for 5 hours and repeat.
sleep 18000
done
exit 0
The script yeilds the following output:
\\Tachikoma\Techno/DJ Sammy/DJ Sammy - Sunlight.mp3
\\Tachikoma\Techno/DJ Sammy/DJ Sammy - The Boys of Summer.mp3
\\Tachikoma\Techno/DJ Sammy/DJ Sammy - Unbreakable.mp3
\\Tachikoma\Techno/DJ Sammy/DJ Sammy - You're My Angel.mp3
\\Tachikoma\Techno/DJ Mangoo/DJ Mangoo - Eurodancer.mp3
\\Tachikoma\Techno/DJ Mangoo/DJ Mangoo - Goodbye.mp3
\\Tachikoma\Techno/DJ Mangoo/DJ Mangoo - Inside You Part 1.mp3
\\Tachikoma\Techno/DJ Mangoo/DJ Mangoo - You are my fantasy.mp3
\\Tachikoma\Techno/DJ Encore/DJ Encore - I See Right Through To You [Extendend Version].mp3
\\Tachikoma\Techno/DJ Encore/DJ Encore - I See Right Through To You.mp3
\\Tachikoma\Techno/DJ Boom Boom/Dj Boom Boom - Ecstasy.mp3
\\Tachikoma\Techno/DJ Boom Boom/DJ Boom Boom - Magic Orgasm (Club 69 Mix).mp3
\\Tachikoma\Techno/DJ Boom Boom/DJ Boom Boom - Up & Down(Remix).mp3
\\Tachikoma\Techno/Daniel Beddingfield/Daniel Beddingfield - Gotta Get Through This.mp3
\\Tachikoma\Techno/Daniel Beddingfield/Daniel Bedingfield - Gotta Get Thru This (Acoustic).mp3
\\Tachikoma\Techno/Aura/Aura - Endless.mp3
\\Tachikoma\Techno/Aura/Aura - The Source of Trance - Cry (Remix).mp3
\\Tachikoma\Techno/Aura/Aura - The Source of Trance - Hold my hand.mp3
Now if you compair the output from the script and the winamp generated you'll notice that the slashes in the script output differ from the winamp generated. From what I can tell from the find documentation is that there is no string subsitution.
So I was wondering if any one knows of a way to do string subsitution within a script or if there is a command that I can use in order to complete what I need to do.
There also might be a slight complication with the newline character that is placed at the end of each line. I dont think that'll be sucha huge problem, and if it is I'll cross that bridge when I come to it.
Inanycase any useful information, feedback or insightful comments are apprecaited.