#!/bin/bash
FILEREALPATH=$1
#this is the first argument that xmms passes
SONGNAME=$2
#this is the second argument that xmms passes
FILEPATH=`echo $FILEREALPATH | tail -c +16`
#this is to chop off the first part of the absolute filepath,
#which I will replace with the path that is correct on the client pc's
DATUMSTAMP=`date | awk '{print $2$3}'`
#this initialises this variable as the date, which gets put in the filename of the resulting html file
cd /home/music/songlists
#moving to the directory where I will put all the playlist files
date | awk '{print $1" "$2" "$3" "$4":"}' >> playedsonglistcontents$DATUMSTAMP
#this creates or adds to a template with the date in the name
echo "$SONGNAME
" >> playedsonglistcontents$DATUMSTAMP
# and this adds the html code for the clickable link with the filename as a link and the path as the referenced value
cat headersonglist.html > html/playedsonglists$DATUMSTAMP.html
cat playedsonglistcontents$DATUMSTAMP >> html/playedsonglists$DATUMSTAMP.html
cat footersonglists.html >> html/playedsonglists$DATUMSTAMP.html
# these 3 lines just create a correct html file with the proper header and footer to be W3C correct
# the header naturally contains also a nice image to present things in a nicer way