I changed the metadata folder in the shairport.service like this:
--meta-dir=/var/www/shairport
And with this script i will get the cover in the webfolder shairport/cover.jpg. The sing infos are parsed to json to the same folder as now_playing.json.
Now i only have to trigger the filechange of now_playing to run my shell script and build a little PHP site to show the cover on the web ui.
Maybe someone can help me so i can use the normal web ui and don't have to build my own one
Here the getInfo.sh script:
#!/bin/bash
FOLDER=/var/www/shairport
pipe=$FOLDER/now_playing
datafile=$pipe.json
stringify() {
a=${1%%=*}
b=${1##*=}
echo "\"$a\": \"$b\""
}
exec 4< $pipe
while read -ru 4 line ; do
if [[ $line == artist* ]]; then
echo '{' > $datafile
elif [ -z "$line" ]; then
echo '}' >> $datafile
continue
fi
# jsonify the string
data=$(stringify "$line")
# for logging
# echo $line
# pretty print the JSON
# comment is the last line of the output
if [[ $line == comment* ]]; then
echo " $data" >> $datafile
else
echo " $data," >> $datafile
fi
done
exec 4<&-
rm $FOLDER/cover.jpg
FILE=$(ls -t $FOLDER/*.jpg | head -1)
cp -f $FILE $FOLDER/cover.jpg
echo Exiting