Skip to content

Commit

Permalink
Fix companion playback crashing
Browse files Browse the repository at this point in the history
  • Loading branch information
croneter committed Apr 14, 2019
1 parent f19674d commit a5fac83
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion resources/lib/kodimonitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ def _load_playerstate(self, item):
status['plex_type'] = item.plex_type
status['playmethod'] = item.playmethod
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):
"""
Expand Down
17 changes: 8 additions & 9 deletions resources/lib/plexbmchelper/subscribers.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,18 +159,17 @@ def msg(self, players):
v.PLEX_PLAYLIST_TYPE_AUDIO: None,
v.PLEX_PLAYLIST_TYPE_PHOTO: None
}
for typus in timelines:
if players.get(v.KODI_PLAYLIST_TYPE_FROM_PLEX_PLAYLIST_TYPE[typus]) is None:
for plex_type in timelines:
kodi_type = v.KODI_PLAYLIST_TYPE_FROM_PLEX_PLAYLIST_TYPE[plex_type]
if players.get(kodi_type) is None:
timeline = {
'controllable': CONTROLLABLE[typus],
'type': typus,
'controllable': CONTROLLABLE[plex_type],
'type': plex_type,
'state': 'stopped'
}
else:
timeline = self._timeline_dict(players[
v.KODI_PLAYLIST_TYPE_FROM_PLEX_PLAYLIST_TYPE[typus]],
typus)
timelines[typus] = self._dict_to_xml(timeline)
timeline = self._timeline_dict(players[kodi_type], plex_type)
timelines[plex_type] = self._dict_to_xml(timeline)
timelines.update({'command_id': '{command_id}',
'location': self.location})
return answ.format(**timelines)
Expand Down Expand Up @@ -302,7 +301,7 @@ def _plex_stream_index(self, playerid, stream_type):
playqueue = PQ.PLAYQUEUES[playerid]
info = app.PLAYSTATE.player_states[playerid]
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
else:
kodi_stream_index = info[STREAM_DETAILS[stream_type]]['index']
Expand Down

0 comments on commit a5fac83

Please sign in to comment.