alles,was sich so angesammelt hat
This commit is contained in:
parent
9ea4115722
commit
82d39233eb
38 changed files with 1720 additions and 0 deletions
40
Soundtouch 2.py
Normal file
40
Soundtouch 2.py
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
import urllib.request
|
||||
|
||||
class soundtouch():
|
||||
def __init__(self):
|
||||
self.url="http://10.0.1.27:8090/"
|
||||
def Webaufruf(self,befehl):
|
||||
try:
|
||||
self.urli=self.url+befehl
|
||||
antwort = urllib.request.urlopen(self.urli)
|
||||
b = (antwort.read())
|
||||
self.xmlString = b.decode("utf-8")
|
||||
return self.xmlString
|
||||
except:
|
||||
return None
|
||||
def now_playing(self):
|
||||
return self.Webaufruf("now_playing")
|
||||
return antwort
|
||||
def info(self):
|
||||
return self.Webaufruf("info")
|
||||
def sources(self):
|
||||
return self.Webaufruf("sources")
|
||||
def presets(self):
|
||||
return self.Webaufruf("presets")
|
||||
def volume(self):
|
||||
return self.Webaufruf("volume")
|
||||
def suche (self,suchstring):
|
||||
string = self.info()
|
||||
anfang = string.find("<"+suchstring+">") + len("<"+suchstring+">")
|
||||
ende = string.find("</"+suchstring+">")
|
||||
if ende != -1:
|
||||
return string[anfang:ende]
|
||||
else:
|
||||
return None
|
||||
|
||||
bose=soundtouch()
|
||||
print((bose.info()))
|
||||
print((bose.presets()))
|
||||
print((bose.volume()))
|
||||
print((bose.now_playing()))
|
||||
print((bose.suche("softwareVersion")))
|
||||
Loading…
Add table
Add a link
Reference in a new issue