No Description
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.

trackchange.sh 1.3KB

123456789101112131415161718192021222324252627282930
  1. #!/bin/sh
  2. lasttrack=`cat /Users/thomas/.lasttrack`
  3. host=`hostname`
  4. datum=`date`
  5. if [ "\"$1\"" != "$lasttrack" ]; then
  6. if [ "$1" != "" ]; then
  7. echo "<html><head><meta charset=\"utf-8\" /><title>xythobuz listened to...</title></head><body><pre>" > /Users/thomas/.tmpfile
  8. echo "Last song played on <b>${host}</b>'s iTunes:" >> /Users/thomas/.tmpfile
  9. echo >> /Users/thomas/.tmpfile
  10. echo " <b>$1</b>" >> /Users/thomas/.tmpfile
  11. echo "by" >> /Users/thomas/.tmpfile
  12. echo " <b>$2</b>" >> /Users/thomas/.tmpfile
  13. echo "on the Album" >> /Users/thomas/.tmpfile
  14. echo " <b>$3</b>" >> /Users/thomas/.tmpfile
  15. echo "at" >> /Users/thomas/.tmpfile
  16. echo " <i>${datum}</i>" >> /Users/thomas/.tmpfile
  17. echo >> /Users/thomas/.tmpfile
  18. echo "Last songs played:" >> /Users/thomas/.tmpfile
  19. cat /Users/thomas/.trackhistory >> /Users/thomas/.tmpfile
  20. echo "</pre><p><a href="http://xythobuz.de">Return...</a></p></body></html>" >> /Users/thomas/.tmpfile
  21. echo \"$1\" > /Users/thomas/.lasttrack
  22. echo "<b>$1</b> by <b>$2</b> on <b>$3</b> at <i>${datum}</i>" >> /Users/thomas/.trackhistory
  23. tail -n 3 /Users/thomas/.trackhistory | tee /Users/thomas/.trackhistory
  24. scp /Users/thomas/.tmpfile zaphod:/var/www/lastmusic
  25. fi
  26. fi