Code Sample |
#!/bin/bash SONGTITLE=`wget http://wktz.jones.edu/wktz/BSI_WKTZFM_Page.htm -O - | \ grep "[0-9][0-9]*:[0-9][0-9]*:[0-9][0-9]*" | \ sed 's/.*>\(.*\)<br><\/font>/\1/' | \ head -n 1| \ sed 's/.*, \(.*\)/\1/'` echo "The current song is $SONGTITLE" |
Code Sample |
#!/bin/bash # Real time lyrics viewer for Jones College Radio (http://wktz.jones.edu) i=1 while [ i=1 ] # infinite loop do SONGTITLE=`wget http://wktz.jones.edu/wktz/BSI_WKTZFM_Page.htm -O - | \ grep "[0-9][0-9]*:[0-9][0-9]*:[0-9][0-9]*" | \ sed 's/.*>\(.*\)<br><\/font>/\1/' | \ tail -n 1 | \ sed 's/.*, \(.*\)/\1/'` echo "Currently playing: $SONGTITLE" if [ "$SONGTITLE1" != "$SONGTITLE" ] # Check if the playlist was updated then #+ prevent open one lyrics file more than one time. echo "New song playing" if [ -e "$SONGTITLE" ] # Check if lyrics file exists. then # Write here command to open the $SONGTITLE file using text editor. kate "$SONGTITLE" # Kate text editor in this example else # write here command if want to generate automatically empty lyrics files echo "$file Lyrics file does not exist yet." fi fi SONGTITLE1="$SONGTITLE" # Actual song title stored for next iteration sleep 10 # Delay 10 seg before retrieve playlist again. done #Thanks Dare2Dreamer, Clacker and Tedmoore99 users from DSL Forum |