Treat unsuccessful download better

This commit is contained in:
tomkat83 2017-03-05 16:51:13 +01:00
parent 260579f32d
commit 3d525f7772

View file

@ -14,8 +14,7 @@ from PlexFunctions import ParseContainerKey, GetPlexMetadata
from PlexAPI import API 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, \ import variables as v
PLEX_TO_KODI_TIMEFACTOR
############################################################################### ###############################################################################
@ -110,14 +109,19 @@ class PlexCompanion(Thread):
return return
try: 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']]) v.KODI_PLAYLIST_TYPE_FROM_PLEX_TYPE[data['type']])
except KeyError: except KeyError:
# E.g. Plex web does not supply the media type # E.g. Plex web does not supply the media type
# Still need to figure out the type (video vs. music vs. pix) # Still need to figure out the type (video vs. music vs. pix)
xml = GetPlexMetadata(data['key']) xml = GetPlexMetadata(data['key'])
try:
xml[0].attrib
except (AttributeError, IndexError, TypeError):
log.error('Could not download Plex metadata')
return
api = API(xml[0]) api = API(xml[0])
playqueue = self.mgr.playqueue.get_playqueue_from_type( playqueue = self.mgr.playqueue.get_playqueue_from_type(
KODI_PLAYLIST_TYPE_FROM_PLEX_TYPE[api.getType()]) v.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,