My static website generator using poole https://www.xythobuz.de
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2013_05_17_itunes.md 2.0KB

title: Blog post: Musik Script History date: 2013-05-17

comments: true

Ja, ich gebe zu, daß mein Shell Skript wirklich sehr hässlich war. Jetzt ist es zwar immer noch hässlich, aber nicht ganz so sehr. Und es merkt sich die letzten 10 gespielten Songs. Fuck yeah :D

Der Output ist nach wie vor hier zu sehen

#!/bin/sh

lasttrack=`cat /Users/thomas/.lasttrack`
host=`hostname`
datum=`date`

if [ "$1" != "$lasttrack" ]; then
    if [ "$1" != "" ]; then
        echo "<html><head><meta charset=\"utf-8\" /><title>xythobuz listened to...</title></head><body><pre>" > /Users/thomas/.tmpfile
        echo "Last song played on <b>${host}</b>'s iTunes:" >> /Users/thomas/.tmpfile
        echo >> /Users/thomas/.tmpfile
        echo "  <b>$1</b>" >> /Users/thomas/.tmpfile
        echo "by" >> /Users/thomas/.tmpfile
        echo "  <b>$2</b>" >> /Users/thomas/.tmpfile
        echo "on the Album" >> /Users/thomas/.tmpfile
        echo "  <b>$3</b>" >> /Users/thomas/.tmpfile
        echo "at" >> /Users/thomas/.tmpfile
        echo "  <i>${datum}</i>" >> /Users/thomas/.tmpfile
        echo >> /Users/thomas/.tmpfile
        echo "Last Songs played:" >> /Users/thomas/.tmpfile
        cat /Users/thomas/.trackhistory >> /Users/thomas/.tmpfile
        echo "</pre></body></html>" >> /Users/thomas/.tmpfile

        scp /Users/thomas/.tmpfile zaphod:/var/www/lastmusic
        echo $1 > /Users/thomas/.lasttrack
        echo "<b>$1</b> by <b>$2</b> on <b>$3</b> at <i>${datum}</i>" >> /Users/thomas/.trackhistory
        tail -n 10 /Users/thomas/.trackhistory | tee /Users/thomas/.trackhistory
    fi
fi