the current dir it should look like this
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<playlist version="1" xmlns="http://xspf.org/ns/0/">
<trackList>
<track><location>file:///mp3s/song_1.mp3</location></track>
<track><location>file:///mp3s/song_2.mp3</location></track>
<track><location>file:///mp3s/song_3.mp3</location></track>
</trackList>
</playlist>
Code: Select all
#!/bin/bash
# Headers and footers
HDR0='<?xml version="1.0" encoding="UTF-8"?>'
HDR1='<playlist version="1" xmlns="http://xspf.org/ns/0/">'
HDR2='<trackList>'
FTR0='</trackList>'
FTR1='</playlist>'
ATR1='<track><location>file://'
ATR2='</location></track>'
#write header
echo $HDR0 >/tmp/playlist
echo $HDR1 >>/tmp/playlist
echo $HDR2 >>/tmp/playlist
find . -type f | sed "s/.*\(mp3\|wav\|ogg\)"`'|sort>/tmp/playprep
####Now how do i read /tmp/playprep a line at a time and prefix it
####with ATR1 and suffixing it with ATR or is that the way to go any
####help would be great
#write footer
echo $FTR0 >>/tmp/playlist
echo $FTR1 >>/tmp/playlist
echo $FTR2 >>/tmp/playlist