Fix Plex Companion playstate status for iOS

- Partially fixes #456
This commit is contained in:
croneter 2018-05-13 15:50:26 +02:00
parent 5241baef28
commit 4a948c1639

View file

@ -119,7 +119,7 @@ class SubscriptionMgr(object):
self.server = "" self.server = ""
self.protocol = "http" self.protocol = "http"
self.port = "" self.port = ""
self.isplaying = False self.location = 'navigation'
# In order to be able to signal a stop at the end # In order to be able to signal a stop at the end
self.last_params = {} self.last_params = {}
self.lastplayers = {} self.lastplayers = {}
@ -144,7 +144,7 @@ class SubscriptionMgr(object):
Returns a timeline xml as str Returns a timeline xml as str
(xml containing video, audio, photo player state) (xml containing video, audio, photo player state)
""" """
self.isplaying = False self.location = 'navigation'
answ = str(XML) answ = str(XML)
timelines = { timelines = {
v.PLEX_PLAYLIST_TYPE_VIDEO: None, v.PLEX_PLAYLIST_TYPE_VIDEO: None,
@ -163,8 +163,8 @@ class SubscriptionMgr(object):
v.KODI_PLAYLIST_TYPE_FROM_PLEX_PLAYLIST_TYPE[typus]], v.KODI_PLAYLIST_TYPE_FROM_PLEX_PLAYLIST_TYPE[typus]],
typus) typus)
timelines[typus] = self._dict_to_xml(timeline) timelines[typus] = self._dict_to_xml(timeline)
location = 'fullScreenVideo' if self.isplaying else 'navigation' timelines.update({'command_id': '{command_id}',
timelines.update({'command_id': '{command_id}', 'location': location}) 'location': self.location})
return answ.format(**timelines) return answ.format(**timelines)
@staticmethod @staticmethod
@ -191,7 +191,8 @@ class SubscriptionMgr(object):
'type': ptype, 'type': ptype,
'state': 'stopped' 'state': 'stopped'
} }
self.isplaying = True if ptype in (v.PLEX_PLAYLIST_TYPE_VIDEO, v.PLEX_PLAYLIST_TYPE_PHOTO):
self.location = 'fullScreenVideo'
self.stop_sent_to_web = False self.stop_sent_to_web = False
pbmc_server = window('pms_server') pbmc_server = window('pms_server')
if pbmc_server: if pbmc_server:
@ -202,7 +203,6 @@ class SubscriptionMgr(object):
shuffle = '1' if info['shuffled'] else '0' shuffle = '1' if info['shuffled'] else '0'
mute = '1' if info['muted'] is True else '0' mute = '1' if info['muted'] is True else '0'
answ = { answ = {
'location': 'fullScreenVideo',
'controllable': CONTROLLABLE[ptype], 'controllable': CONTROLLABLE[ptype],
'protocol': self.protocol, 'protocol': self.protocol,
'address': self.server, 'address': self.server,