Fix some IndexErrors and KeyErrors

This commit is contained in:
croneter 2017-12-13 20:41:29 +01:00
parent 9cac51d5c9
commit 80c106d57f
2 changed files with 7 additions and 5 deletions

View file

@ -17,7 +17,7 @@ from PlexFunctions import init_plex_playqueue
from PKC_listitem import PKC_ListItem as ListItem, convert_PKC_to_listitem
from playlist_func import add_item_to_kodi_playlist, \
get_playlist_details_from_xml, add_listitem_to_Kodi_playlist, \
add_listitem_to_playlist, remove_from_kodi_playlist
add_listitem_to_playlist, remove_from_kodi_playlist, playlist_item_from_xml
from pickler import Playback_Successful
from plexdb_functions import Get_Plex_DB
import variables as v
@ -140,6 +140,7 @@ class PlaybackUtils():
get_playlist_details_from_xml(playqueue, xml=xml)
except KeyError:
return
playqueue.items.append(playlist_item_from_xml(playqueue, xml[0]))
if (not homeScreen and not seektime and sizePlaylist < 2 and
window('plex_customplaylist') != "true" and

View file

@ -90,7 +90,6 @@ class SubscriptionManager:
def _get_container_key(self, playerid):
key = None
playlistid = state.PLAYER_STATES[playerid]['playlistid']
LOG.debug('type: %s, playlistid: %s', type(playlistid), playlistid)
if playlistid != -1:
# -1 is Kodi's answer if there is no playlist
try:
@ -198,7 +197,8 @@ class SubscriptionManager:
def _get_pms_params(self, playerid):
info = state.PLAYER_STATES[playerid]
status = 'paused' if info['speed'] == '0' else 'playing'
params = {'state': status,
params = {
'state': status,
'ratingKey': self.ratingkey,
'key': '/library/metadata/%s' % self.ratingkey,
'time': kodi_time_to_millis(info['time']),
@ -208,8 +208,9 @@ class SubscriptionManager:
params['containerKey'] = self.containerKey
if self.containerKey is not None and \
self.containerKey.startswith('/playQueues/'):
params['playQueueVersion'] = info['playQueueVersion']
params['playQueueItemID'] = info['playQueueItemID']
playqueue = self.playqueue.playqueues[playerid]
params['playQueueVersion'] = playqueue.version
params['playQueueItemID'] = playqueue.id
self.last_params = params
return params