Plex Companion: Fix KeyError for Plex Web

This commit is contained in:
tomkat83 2017-02-18 17:15:37 +01:00
parent b93925d678
commit 990e21ac99

View file

@ -9,7 +9,8 @@ from xbmc import sleep
from utils import settings, ThreadMethodsAdditionalSuspend, ThreadMethods from utils import settings, ThreadMethodsAdditionalSuspend, ThreadMethods
from plexbmchelper import listener, plexgdm, subscribers, functions, \ from plexbmchelper import listener, plexgdm, subscribers, functions, \
httppersist, plexsettings httppersist, plexsettings
from PlexFunctions import ParseContainerKey from PlexFunctions import ParseContainerKey, GetPlexMetadata
from PlexAPI import API
import player import player
from entrypoint import Plex_Node from entrypoint import Plex_Node
from variables import KODI_PLAYLIST_TYPE_FROM_PLEX_TYPE from variables import KODI_PLAYLIST_TYPE_FROM_PLEX_TYPE
@ -95,8 +96,16 @@ class PlexCompanion(Thread):
import traceback import traceback
log.error("Traceback:\n%s" % traceback.format_exc()) log.error("Traceback:\n%s" % traceback.format_exc())
return return
try:
playqueue = self.mgr.playqueue.get_playqueue_from_type( playqueue = self.mgr.playqueue.get_playqueue_from_type(
KODI_PLAYLIST_TYPE_FROM_PLEX_TYPE[data['type']]) KODI_PLAYLIST_TYPE_FROM_PLEX_TYPE[data['type']])
except KeyError:
# E.g. Plex web does not supply the media type
# Still need to figure out the type (video vs. music vs. pix)
xml = GetPlexMetadata(data['key'])
api = API(xml[0])
playqueue = self.mgr.playqueue.get_playqueue_from_type(
KODI_PLAYLIST_TYPE_FROM_PLEX_TYPE[api.getType()])
self.mgr.playqueue.update_playqueue_from_PMS( self.mgr.playqueue.update_playqueue_from_PMS(
playqueue, playqueue,
ID, ID,