Fix companion playback crashing

This commit is contained in:
croneter 2019-04-14 17:54:47 +02:00
parent 2dac26ffc4
commit 130ec674e5
2 changed files with 9 additions and 10 deletions

View file

@ -368,7 +368,7 @@ class KodiMonitor(xbmc.Monitor):
status['plex_type'] = item.plex_type status['plex_type'] = item.plex_type
status['playmethod'] = item.playmethod status['playmethod'] = item.playmethod
status['playcount'] = item.playcount status['playcount'] = item.playcount
LOG.debug('Set the player state: %s', status) LOG.debug('Set player state for player %s: %s', self.playerid, status)
def on_play(self, data): def on_play(self, data):
""" """

View file

@ -159,18 +159,17 @@ class SubscriptionMgr(object):
v.PLEX_PLAYLIST_TYPE_AUDIO: None, v.PLEX_PLAYLIST_TYPE_AUDIO: None,
v.PLEX_PLAYLIST_TYPE_PHOTO: None v.PLEX_PLAYLIST_TYPE_PHOTO: None
} }
for typus in timelines: for plex_type in timelines:
if players.get(v.KODI_PLAYLIST_TYPE_FROM_PLEX_PLAYLIST_TYPE[typus]) is None: kodi_type = v.KODI_PLAYLIST_TYPE_FROM_PLEX_PLAYLIST_TYPE[plex_type]
if players.get(kodi_type) is None:
timeline = { timeline = {
'controllable': CONTROLLABLE[typus], 'controllable': CONTROLLABLE[plex_type],
'type': typus, 'type': plex_type,
'state': 'stopped' 'state': 'stopped'
} }
else: else:
timeline = self._timeline_dict(players[ timeline = self._timeline_dict(players[kodi_type], plex_type)
v.KODI_PLAYLIST_TYPE_FROM_PLEX_PLAYLIST_TYPE[typus]], timelines[plex_type] = self._dict_to_xml(timeline)
typus)
timelines[typus] = self._dict_to_xml(timeline)
timelines.update({'command_id': '{command_id}', timelines.update({'command_id': '{command_id}',
'location': self.location}) 'location': self.location})
return answ.format(**timelines) return answ.format(**timelines)
@ -302,7 +301,7 @@ class SubscriptionMgr(object):
playqueue = PQ.PLAYQUEUES[playerid] playqueue = PQ.PLAYQUEUES[playerid]
info = app.PLAYSTATE.player_states[playerid] info = app.PLAYSTATE.player_states[playerid]
position = self._get_correct_position(info, playqueue) position = self._get_correct_position(info, playqueue)
if info[STREAM_DETAILS[stream_type]] == -1: if info[STREAM_DETAILS[stream_type]] in (-1, None):
kodi_stream_index = -1 kodi_stream_index = -1
else: else:
kodi_stream_index = info[STREAM_DETAILS[stream_type]]['index'] kodi_stream_index = info[STREAM_DETAILS[stream_type]]['index']