Fix TypeError for selecting Plex media streams

This commit is contained in:
croneter 2018-11-06 15:12:17 +01:00
parent 440f399917
commit a75afc109c
2 changed files with 14 additions and 4 deletions

View file

@ -204,14 +204,20 @@ class Playlist_Item(object):
"""
stream_type = v.PLEX_STREAM_TYPE_FROM_STREAM_TYPE[stream_type]
count = 0
if kodi_stream_index == -1:
# Kodi telling us "it's the last one"
iterator = list(reversed(self.xml[0][self.part]))
kodi_stream_index = 0
else:
iterator = self.xml[0][self.part]
# Kodi indexes differently than Plex
for stream in self.xml[0][self.part]:
for stream in iterator:
if (stream.attrib['streamType'] == stream_type and
'key' in stream.attrib):
if count == kodi_stream_index:
return stream.attrib['id']
count += 1
for stream in self.xml[0][self.part]:
for stream in iterator:
if (stream.attrib['streamType'] == stream_type and
'key' not in stream.attrib):
if count == kodi_stream_index:

View file

@ -303,8 +303,12 @@ class SubscriptionMgr(object):
playqueue = PQ.PLAYQUEUES[playerid]
info = state.PLAYER_STATES[playerid]
position = self._get_correct_position(info, playqueue)
return playqueue.items[position].plex_stream_index(
info[STREAM_DETAILS[stream_type]]['index'], stream_type)
if info[STREAM_DETAILS[stream_type]] == -1:
kodi_stream_index = -1
else:
kodi_stream_index = info[STREAM_DETAILS[stream_type]]['index']
return playqueue.items[position].plex_stream_index(kodi_stream_index,
stream_type)
def update_command_id(self, uuid, command_id):
"""