Streamline code

This commit is contained in:
tomkat83 2016-10-11 18:37:47 +02:00
parent 4b0583b1c9
commit c02a95cc59

View file

@ -1437,12 +1437,9 @@ class LibrarySync(Thread):
def process_newitems(self, item): def process_newitems(self, item):
ratingKey = item['ratingKey'] ratingKey = item['ratingKey']
xml = PF.GetPlexMetadata(ratingKey) xml = PF.GetPlexMetadata(ratingKey)
if xml in (None, 401):
log.error('Could not download data for %s, skipping' % ratingKey)
return False, item
try: try:
mediatype = xml[0].attrib['type'] mediatype = xml[0].attrib['type']
except (IndexError, KeyError): except (IndexError, KeyError, TypeError):
log.error('Could not download metadata for %s' % ratingKey) log.error('Could not download metadata for %s' % ratingKey)
return False, item return False, item
log.debug("Processing new/updated PMS item: %s" % ratingKey) log.debug("Processing new/updated PMS item: %s" % ratingKey)