parent
cb663913a0
commit
d0e2b7c3d6
1 changed files with 16 additions and 9 deletions
|
@ -67,19 +67,26 @@ class DownloadUtils():
|
||||||
|
|
||||||
def postCapabilities(self, deviceId):
|
def postCapabilities(self, deviceId):
|
||||||
|
|
||||||
# Post settings to session
|
# Get sessionId
|
||||||
url = "{server}/mediabrowser/Sessions/Capabilities/Full"
|
url = "{server}/mediabrowser/Sessions?DeviceId=%s&format=json" % deviceId
|
||||||
data = {
|
result = self.downloadUrl(url)
|
||||||
'PlayableMediaTypes': "Audio,Video",
|
# sessionId result
|
||||||
'SupportedCommands': "Play,Playstate,SendString,DisplayMessage,PlayNext",
|
self.logMsg("Session result: %s" % result, 2)
|
||||||
'SupportsMediaControl': True
|
self.sessionId = result[0][u'Id']
|
||||||
}
|
self.WINDOW.setProperty('sessionId%s' % self.username, self.sessionId)
|
||||||
|
|
||||||
|
# Settings for capabilities
|
||||||
|
playableMediaTypes = "Audio,Video"
|
||||||
|
supportedCommands = "Play,Playstate,SendString,DisplayMessage,PlayNext"
|
||||||
|
|
||||||
|
# Post settings to sessionId
|
||||||
|
url = "{server}/mediabrowser/Sessions/Capabilities?Id=%s&PlayableMediaTypes=%s&SupportedCommands=%s&SupportsMediaControl=True" % (self.sessionId, playableMediaTypes, supportedCommands)
|
||||||
|
data = {}
|
||||||
self.logMsg("Capabilities URL: %s" % url, 2)
|
self.logMsg("Capabilities URL: %s" % url, 2)
|
||||||
self.logMsg("PostData: %s" % data, 2)
|
self.logMsg("PostData: %s" % data, 2)
|
||||||
|
|
||||||
result = self.downloadUrl(url, postBody=data, type="POST")
|
self.downloadUrl(url, postBody=data, type="POST")
|
||||||
self.logMsg("Posted capabilities to %s" % self.server, 1)
|
self.logMsg("Posted capabilities to sessionId: %s" % self.sessionId, 1)
|
||||||
|
|
||||||
def startSession(self):
|
def startSession(self):
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue