Skip to content

Instantly share code, notes, and snippets.

@mrngm
Created April 16, 2012 12:08
Show Gist options
  • Save mrngm/2398290 to your computer and use it in GitHub Desktop.
Save mrngm/2398290 to your computer and use it in GitHub Desktop.
$ cat mariespul.sh
#!/bin/bash
#SERVER="loungemuziek"
SERVER="noordslet.science.ru.nl"
PORT="1337"
QUEUE=`echo 'LIST::QUEUE' | nc $SERVER $PORT`
NP=`echo 'LIST::NOWPLAYING' | nc $SERVER $PORT | cut -d ':' -f 3`
ALLNP=`echo 'LIST::ALL' | nc $SERVER $PORT | grep "SONG::$NP"`
NUMQUEUE=`echo $QUEUE | cut -d ':' -f 3`
TIMELEFT=`echo $QUEUE | cut -d ':' -f 7 | cut -d ' ' -f 1`
TIMELEFTMIN=`echo $(($TIMELEFT / 60))`
TIMELEFTSEC=`echo $(($TIMELEFT % 60))`
NEXTUPARTIST=`echo $QUEUE | cut -d ':' -f 9`
NEXTUPTITLE=`echo $QUEUE | cut -d ':' -f 11`
NEXTUPREQ=`echo $QUEUE | cut -d ':' -f 15 | sed -e 's/\(.*\) \(.*\)/\1/'`
#NEXTUP=`echo $QUEUE | grep -i song | head -n 1 `
CURRENTARTIST=`echo $ALLNP | cut -d ':' -f 5`
CURRENTTITLE=`echo $ALLNP | cut -d ':' -f 7`
TIMEREMAIN=""
if [ $TIMELEFTMIN -gt 0 ]; then
TIMEREMAIN="$TIMEREMAIN$TIMELEFTMIN min"
fi
TIMEREMAIN="$TIMEREMAIN $TIMELEFTSEC sec"
#echo "$NEXTUP"
#echo "$ALL"
#echo "$NP"
#echo "$TIMELEFTMIN min $TIMELEFTSEC sec -- $TIMEREMAIN"
echo "#noordkantine np. $CURRENTARTIST - $CURRENTTITLE (resterend: $TIMEREMAIN)"
echo "#noordkantine next: $NEXTUPARTIST - $NEXTUPTITLE (aangevraagd door $NEXTUPREQ)"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment