From 45a385f36e3cb9153c81c07d79799683643e4421 Mon Sep 17 00:00:00 2001 From: Jonathan Wong Date: Sun, 27 Sep 2015 00:06:30 -0700 Subject: [PATCH] Always match child (episode or track) by index --- plexpy/datafactory.py | 8 ++++---- plexpy/pmsconnect.py | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/plexpy/datafactory.py b/plexpy/datafactory.py index 401b32d5..cb25ac49 100644 --- a/plexpy/datafactory.py +++ b/plexpy/datafactory.py @@ -849,10 +849,10 @@ class DataFactory(object): key_list = {0: {'rating_key': int(rating_key)}} return key_list - if media_type == 'show' or media_type == 'season' or media_type == 'episode': - match_type = 'index' - elif media_type == 'artist' or media_type == 'album' or media_type == 'track': + if media_type == 'artist' or media_type == 'album' or media_type == 'track': match_type = 'title' + else: + match_type = 'index' # Get the grandparent rating key try: @@ -891,7 +891,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'] if match_type == 'index' else item['title'] + key = item['media_index'] 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 69622a7b..687725b4 100644 --- a/plexpy/pmsconnect.py +++ b/plexpy/pmsconnect.py @@ -1479,10 +1479,10 @@ class PmsConnect(object): key_list = {0: {'rating_key': int(rating_key)}} return key_list - if media_type == 'show' or media_type == 'season' or media_type == 'episode': - match_type = 'index' - elif media_type == 'artist' or media_type == 'album' or media_type == 'track': + if media_type == 'artist' or media_type == 'album' or media_type == 'track': match_type = 'title' + else: + match_type = 'index' # get grandparent rating key if media_type == 'season' or media_type == 'album': @@ -1557,7 +1557,7 @@ class PmsConnect(object): child_title = helpers.get_xml_attr(item, 'title') if child_rating_key: - key = int(child_index) if match_type == 'index' else child_title + key = int(child_index) children.update({key: {'rating_key': int(child_rating_key)}}) key = int(parent_index) if match_type == 'index' else parent_title