Fix sessionId bug

This commit is contained in:
angelblue05 2015-05-02 21:06:09 -05:00
parent 3b6d08cd2e
commit cb663913a0

View file

@ -67,26 +67,19 @@ class DownloadUtils():
def postCapabilities(self, deviceId):
# Get sessionId
url = "{server}/mediabrowser/Sessions?DeviceId=%s&format=json" % deviceId
result = self.downloadUrl(url)
# sessionId result
self.logMsg("Session result: %s" % result, 2)
self.sessionId = result[0][u'Id']
self.WINDOW.setProperty('sessionId%s' % self.username, self.sessionId)
# Post settings to session
url = "{server}/mediabrowser/Sessions/Capabilities/Full"
data = {
'PlayableMediaTypes': "Audio,Video",
'SupportedCommands': "Play,Playstate,SendString,DisplayMessage,PlayNext",
'SupportsMediaControl': True
}
# 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("PostData: %s" % data, 2)
self.downloadUrl(url, postBody=data, type="POST")
self.logMsg("Posted capabilities to sessionId: %s" % self.sessionId, 1)
result = self.downloadUrl(url, postBody=data, type="POST")
self.logMsg("Posted capabilities to %s" % self.server, 1)
def startSession(self):