#!/bin/bash killall festival 2> /dev/null FILEREALPATH=$1 #this is the first argument that xmms passes SONGNAME=$2 #this is the second argument that xmms passes 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 # check if last line already contains this song: LASTSONG=`tail -n 1 playedsonglistcontents$DATUMSTAMP` NEWSONG=`echo "$SONGNAME

"` if [ "$LASTSONG" != "$NEWSONG" ] then date | awk '{print $1" "$2" "$3" "$4":"}' >> playedsonglistcontents$DATUMSTAMP echo $NEWSONG >> playedsonglistcontents$DATUMSTAMP fi # 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 cp html/playedsonglists$DATUMSTAMP.html html/playedsonglistslatesttemp.html cat html/playedsonglistslatesttemp.html | sed "s///" > html/playedsonglistslatest.html rm -f html/playedsonglistslatesttemp.html rm -f html/playedsonglistslatesttemp1.html #to uncomment an auto reload header into the html code for the latest page. cd /home/music/saysong if [[ "$FILEREALPATH" == *.ogg || "$FILEREALPATH" == *.OGG ]] then ogginfo "$FILEREALPATH" | grep -A 3 title | grep -v 'genre=' | sed "s/\t//" > oggsonginfo tail -n 2 oggsonginfo > songplaying head -n 1 oggsonginfo >> songplaying cat songplaying | sed "s/title=/\nTitle\n/" | sed "s/artist=/Artist\n/" | sed "s/album=/\nAlbum\n/" > songplaying.txt fi if [[ "$FILEREALPATH" == *.mp3 || "$FILEREALPATH" == *.MP3 ]] then mp3info -p "Artist:\n%a\n\nAlbum:\n%l\n\nTitle:\n%t\n" "$FILEREALPATH" > songplaying.txt fi #check if there was no id3 tag or so; the file no-mp3tag.txt is simply the result if a song has no tag; if there was no tag, construct the artist, album and title from the file path diff songplaying.txt no-mp3tag.txt > songdiff if [[ ! -s songdiff || "$FILEREALPATH" == *.flac ]] then echo "$FILEREALPATH" | sed "s/\/mnt\/paris\/maxtor60\/maxtor46part\/robertsdir\/mp3//" | sed "s/\//Artist\n/" | sed "s/\//\n\nAlbum\n/" | sed "s/\//\n\nTitle\n/" | sed "s/.mp3//" | sed "s/.ogg//" | sed "s/.flac//" > songplaying.txt fi #brushing up on the weirdly spoken things... cat songplaying.txt | sed "y/ & / n /" | sed "y/_/ /" | sed "y/-/ /" > songplaying.txt nice -n 19 text2wave songplaying.txt -o songplaying.wav