This commit is contained in:
tomkat83 2016-08-10 19:03:37 +02:00
parent 99e1239acc
commit 0315773009
2 changed files with 16 additions and 15 deletions

View file

@ -180,6 +180,7 @@ class PlexCompanion(threading.Thread):
message_count += 1
if httpd:
if not t.isAlive():
# Use threads cause the method will stall
t = threading.Thread(target=httpd.handle_request)
t.start()

View file

@ -15,7 +15,7 @@ class SubscriptionManager:
self.info = {}
self.lastkey = ""
self.containerKey = ""
self.lastratingkey = ""
self.ratingkey = ""
self.volume = 0
self.mute = '0'
self.server = ""
@ -93,21 +93,21 @@ class SubscriptionManager:
xbmc.sleep(100)
count += 1
if keyid:
self.lastkey = "/library/metadata/%s"%keyid
self.lastratingkey = keyid
ret += ' location="%s"' % (self.mainlocation)
ret += ' key="%s"' % (self.lastkey)
ret += ' ratingKey="%s"' % (self.lastratingkey)
self.lastkey = "/library/metadata/%s" % keyid
self.ratingkey = keyid
ret += ' location="%s"' % self.mainlocation
ret += ' key="%s"' % self.lastkey
ret += ' ratingKey="%s"' % self.ratingkey
serv = self.getServerByHost(self.server)
if info.get('playQueueID'):
self.containerKey = "/playQueues/%s" % info.get('playQueueID')
ret += ' playQueueID="%s"' % info.get('playQueueID')
ret += ' playQueueVersion="%s"' % info.get('playQueueVersion')
ret += ' playQueueItemID="%s"' % (info.get('playQueueItemID'))
ret += ' playQueueItemID="%s"' % info.get('playQueueItemID')
ret += ' containerKey="%s"' % self.containerKey
elif keyid:
self.containerKey = self.lastkey
ret += ' containerKey="%s"' % (self.containerKey)
ret += ' containerKey="%s"' % self.containerKey
ret += ' duration="%s"' % info['duration']
ret += ' seekRange="0-%s"' % info['duration']
@ -132,7 +132,7 @@ class SubscriptionManager:
if commandID and self.subscribers.get(uuid, False):
self.subscribers[uuid].commandID = int(commandID)
def notify(self, event = False):
def notify(self, event=False):
self.cleanup()
# Don't tell anyone if we don't know a Plex ID and are still playing
# (e.g. no stop called). Used for e.g. PVR/TV without PKC usage
@ -145,7 +145,7 @@ class SubscriptionManager:
if self.subscribers:
with threading.RLock():
for sub in self.subscribers.values():
sub.send_update(msg, len(players)==0)
sub.send_update(msg, len(players) == 0)
self.notifyServer(players)
return True
@ -159,7 +159,7 @@ class SubscriptionManager:
params['playQueueVersion'] = info['playQueueVersion']
params['playQueueItemID'] = info['playQueueItemID']
params['key'] = (self.lastkey or "/library/metadata/900000")
params['ratingKey'] = (self.lastratingkey or "900000")
params['ratingKey'] = (self.ratingkey or "900000")
params['state'] = info['state']
params['time'] = info['time']
params['duration'] = info['duration']