My static website generator using poole https://www.xythobuz.de
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

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