Closed argentum2f closed 11 years ago
Note that you could previously do this with eventcmd. This is how I build "Station Name".m3u files.
#!/bin/bash
# create variables
while read L; do
k="`echo "$L" | cut -d '=' -f 1`"
v="`echo "$L" | cut -d '=' -f 2`"
export "$k=$v"
done < <(grep -e '^\(title\|artist\|album\|stationName\|songStationName\|pRet\|pRetStr\|wRet\|wRetStr\|songDuration\|songPlayed\|rating\|coverArt\|songExplorerUrl\|albumExplorerUrl\|audioFileDir\|audioFilePath\|stationCount\|station[0-9]*\)=' /dev/stdin) # don't overwrite $1...
case "$1" in
# ...
songfinish)
m3u="${HOME}/Music/pianobarfly/${stationName}.m3u"
if [ -n "$songDuration" ] && [ "$songDuration" -ne 0 ]; then
s=`echo $songDuration 1000 / p | dc`
echo "#EXTINF:$s,$artist - $title" >> "$m3u"
echo "$audioFilePath" >> "$m3u"
if [ ! -f "../$audioFilePath" -a "$audioFilePath" ]; then
if [ ! -d "$stationName" ]; then
mkdir "$stationName"
fi
if [ ! -f "$stationName/`basename $audioFilePath`" ]; then
ln -s "../$audioFilePath" "$stationName"
fi
fi
fi
;;
# ...
esac
Thanks
Would it be difficult to add an optional label with the name of the station to those we can use for filenames? It would make a lot more sense to me to sort files according to station, rather than artist or album.