Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- # Get SSID:
- SSID=`nmcli -t -f ssid dev wifi | tail -1`
- # If connected to home WiFi, try get track from Raspberry Pi first, then locally.
- # If not connected to home WiFi, just try to get the track locally.
- if [ "$SSID" = "dilseacht_gan_sreang" ]; then
- TRACK=`mpc -h 192.168.8.106 -f "[[[%title% - ]%artist% - ]%album%]" | head -1`
- if [ "$TRACK" = "error: Connection refused" ]; then
- TRACK=`mpc -f "[[[%title% - ]%artist% - ]%album%]" | head -1`
- if [ "$TRACK" = "error: Connection refused" ]; then
- TRACK=""
- fi
- elif [[ "${TRACK}" =~ "volume:" ]]; then
- TRACK=`mpc -f "[[[%title% - ]%artist% - ]%album%]" | head -1`
- if [ "$TRACK" = "error: Connection refused" ]; then
- TRACK=""
- fi
- fi
- else
- TRACK=`mpc -f "[[[%title% - ]%artist% - ]%album%]" | head -1`
- if [ "$TRACK" = "error: Connection refused" ]; then
- TRACK=""
- fi
- fi
- # If mopidy is connected but nothing is in the playlist, display nothing:
- if [[ "${TRACK}" =~ "volume:" ]]; then
- TRACK=""
- fi
- echo $TRACK
- echo $TRACK
- echo "#66CCCC"
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement