Fix TypeError for selecting Plex media streams
This commit is contained in:
parent
440f399917
commit
a75afc109c
2 changed files with 14 additions and 4 deletions
|
@ -204,14 +204,20 @@ class Playlist_Item(object):
|
||||||
"""
|
"""
|
||||||
stream_type = v.PLEX_STREAM_TYPE_FROM_STREAM_TYPE[stream_type]
|
stream_type = v.PLEX_STREAM_TYPE_FROM_STREAM_TYPE[stream_type]
|
||||||
count = 0
|
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
|
# Kodi indexes differently than Plex
|
||||||
for stream in self.xml[0][self.part]:
|
for stream in iterator:
|
||||||
if (stream.attrib['streamType'] == stream_type and
|
if (stream.attrib['streamType'] == stream_type and
|
||||||
'key' in stream.attrib):
|
'key' in stream.attrib):
|
||||||
if count == kodi_stream_index:
|
if count == kodi_stream_index:
|
||||||
return stream.attrib['id']
|
return stream.attrib['id']
|
||||||
count += 1
|
count += 1
|
||||||
for stream in self.xml[0][self.part]:
|
for stream in iterator:
|
||||||
if (stream.attrib['streamType'] == stream_type and
|
if (stream.attrib['streamType'] == stream_type and
|
||||||
'key' not in stream.attrib):
|
'key' not in stream.attrib):
|
||||||
if count == kodi_stream_index:
|
if count == kodi_stream_index:
|
||||||
|
|
|
@ -303,8 +303,12 @@ class SubscriptionMgr(object):
|
||||||
playqueue = PQ.PLAYQUEUES[playerid]
|
playqueue = PQ.PLAYQUEUES[playerid]
|
||||||
info = state.PLAYER_STATES[playerid]
|
info = state.PLAYER_STATES[playerid]
|
||||||
position = self._get_correct_position(info, playqueue)
|
position = self._get_correct_position(info, playqueue)
|
||||||
return playqueue.items[position].plex_stream_index(
|
if info[STREAM_DETAILS[stream_type]] == -1:
|
||||||
info[STREAM_DETAILS[stream_type]]['index'], stream_type)
|
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):
|
def update_command_id(self, uuid, command_id):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in a new issue