Simple Bash Script to Detect if Squeezeplayer is Playing or Paused


Here’s a bit of code running on my Raspberry Pi that detects if the current Squeezelite player is playing or is paused.

Replace 192.168.1.10:9000 with the IP address of the server and replace 62:74:01:10:10:40 with your player ID.

Note, you can find your player ID by hitting the “Settings” link and checking the URL. It will look something like this: http://192.168.1.10:9000/settings/index.html?player=62:74:01:10:10:40&player=62:74:01:10:10:40.

#!/bin/bash
if [ ! -z "`curl http://192.168.1.10:9000/jsonrpc.js --data '{"method":"slim.request","params":["62:74:01:10:10:40",["status","-","mode"]]}' 2>/dev/null | grep -i '"mode":"play"'`" ]; then
        echo PLAYING
else
        echo PAUSED
fi