Fix sessionId bug

This commit is contained in:
angelblue05 2015-05-02 21:28:24 -05:00
parent d0e2b7c3d6
commit 60390a2f24

View file

@ -67,26 +67,22 @@ class DownloadUtils():
def postCapabilities(self, deviceId): def postCapabilities(self, deviceId):
# Get sessionId # Post settings to session
url = "{server}/mediabrowser/Sessions?DeviceId=%s&format=json" % deviceId url = "{server}/mediabrowser/Sessions/Capabilities/Full"
result = self.downloadUrl(url) data = {
# sessionId result 'PlayableMediaTypes': "Audio,Video",
self.logMsg("Session result: %s" % result, 2) 'SupportedCommands': "Play,Playstate,SendString,DisplayMessage,PlayNext",
self.sessionId = result[0][u'Id'] 'SupportsMediaControl': True
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)
try:
self.downloadUrl(url, postBody=data, type="POST") self.downloadUrl(url, postBody=data, type="POST")
self.logMsg("Posted capabilities to sessionId: %s" % self.sessionId, 1) self.logMsg("Posted capabilities to %s" % self.server, 1)
except:
self.logMsg("Posted capabilities failed.")
def startSession(self): def startSession(self):
@ -104,7 +100,6 @@ class DownloadUtils():
cert = self.sslclient cert = self.sslclient
except: except:
self.logMsg("Could not load SSL settings.", 1) self.logMsg("Could not load SSL settings.", 1)
pass
# Start session # Start session
self.s = requests.Session() self.s = requests.Session()