From 041a35a35ab7af255a6e6cec48b6509c105088e8 Mon Sep 17 00:00:00 2001 From: JonnyWong16 Date: Wed, 30 May 2018 21:46:31 -0700 Subject: [PATCH] Fallback to title if missing index for update metadata --- plexpy/datafactory.py | 2 +- plexpy/pmsconnect.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/plexpy/datafactory.py b/plexpy/datafactory.py index 181dafea..ef999550 100644 --- a/plexpy/datafactory.py +++ b/plexpy/datafactory.py @@ -1467,7 +1467,7 @@ class DataFactory(object): result = monitor_db.select(query=query.format('parent_rating_key', 'rating_key'), args=[item['parent_rating_key']]) for item in result: - key = item['media_index'] + key = item['media_index'] if item['media_index'] else item['title'] children.update({key: {'rating_key': item['rating_key']}}) key = item['parent_media_index'] if match_type == 'index' else item['parent_title'] diff --git a/plexpy/pmsconnect.py b/plexpy/pmsconnect.py index 9cfe6808..edfaf585 100644 --- a/plexpy/pmsconnect.py +++ b/plexpy/pmsconnect.py @@ -2664,7 +2664,7 @@ class PmsConnect(object): child_title = helpers.get_xml_attr(item, 'title') if child_rating_key: - key = int(child_index) + key = int(child_index) if child_index else child_title children.update({key: {'rating_key': int(child_rating_key)}}) key = int(parent_index) if match_type == 'index' else parent_title @@ -2676,9 +2676,9 @@ class PmsConnect(object): key = 0 if match_type == 'index' else title key_list = {key: {'rating_key': int(rating_key), 'children': parents}, - 'section_id': section_id, - 'library_name': library_name - } + 'section_id': section_id, + 'library_name': library_name + } return key_list