I'm looking at wiritng a few python scripts to control some ZuneAudio players running on Raspberry pi's around the house.
I can telnet into them and get them to play etc through terminal, and i can get a python script to play from within Indigo, but what i need to be able to get is the status of the player, this means sending a command and then reading the response given.
I can get a list of the status of the device, i just need to get the 1 line - Status.
Here is the code i'm using currently to get the list.
- Code: Select all
import os,re,telnetlib
HOST = "192.168.2.2"
PORT = "6600"
tn = telnetlib.Telnet()
tn.open(HOST, PORT)
tn.write("status\n")
ret1 = tn.read_until("nextsong")
indigo.server.log("\n%s" % ret1)
tn.close
And here's the list. I need to just know if the status is, Play, Pause or Stop.
- Code: Select all
11 Jan 2018, 17:11:20
Script
OK MPD 0.19.0
volume: 78
repeat: 1
random: 0
single: 1
consume: 0
playlist: 11
playlistlength: 4
mixrampdb: 0.000000
state: stop
song: 3
songid: 4
nextsong
Can anyone give me any advice on where to go from here?
Many thanks,
Andrew