Advertisement
Guest User

Untitled

a guest
Jun 30th, 2015
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Get SSID:
  4. SSID=`nmcli -t -f ssid dev wifi | tail -1`
  5.  
  6. # If connected to home WiFi, try get track from Raspberry Pi first, then locally.
  7. # If not connected to home WiFi, just try to get the track locally.
  8. if [ "$SSID" = "dilseacht_gan_sreang" ]; then
  9. TRACK=`mpc -h 192.168.8.106 -f "[[[%title% - ]%artist% - ]%album%]" | head -1`
  10. if [ "$TRACK" = "error: Connection refused" ]; then
  11. TRACK=`mpc -f "[[[%title% - ]%artist% - ]%album%]" | head -1`
  12. if [ "$TRACK" = "error: Connection refused" ]; then
  13. TRACK=""
  14. fi
  15. elif [[ "${TRACK}" =~ "volume:" ]]; then
  16. TRACK=`mpc -f "[[[%title% - ]%artist% - ]%album%]" | head -1`
  17. if [ "$TRACK" = "error: Connection refused" ]; then
  18. TRACK=""
  19. fi
  20. fi
  21. else
  22. TRACK=`mpc -f "[[[%title% - ]%artist% - ]%album%]" | head -1`
  23. if [ "$TRACK" = "error: Connection refused" ]; then
  24. TRACK=""
  25. fi
  26. fi
  27.  
  28. # If mopidy is connected but nothing is in the playlist, display nothing:
  29. if [[ "${TRACK}" =~ "volume:" ]]; then
  30. TRACK=""
  31. fi
  32.  
  33. echo $TRACK
  34. echo $TRACK
  35. echo "#66CCCC"
  36. exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement