diff --git a/plexpy/activity_handler.py b/plexpy/activity_handler.py index 54d49ea6..a45a2cd4 100644 --- a/plexpy/activity_handler.py +++ b/plexpy/activity_handler.py @@ -454,7 +454,7 @@ class TimelineHandler(object): # Schedule a callback to clear the recently added queue schedule_callback('rating_key-{}'.format(grandparent_rating_key), func=clear_recently_added_queue, - args=[grandparent_rating_key], + args=[grandparent_rating_key, title], seconds=plexpy.CONFIG.NOTIFY_RECENTLY_ADDED_DELAY) elif media_type in ('season', 'album'): @@ -469,7 +469,7 @@ class TimelineHandler(object): # Schedule a callback to clear the recently added queue schedule_callback('rating_key-{}'.format(parent_rating_key), func=clear_recently_added_queue, - args=[parent_rating_key], + args=[parent_rating_key, title], seconds=plexpy.CONFIG.NOTIFY_RECENTLY_ADDED_DELAY) elif media_type in ('movie', 'show', 'artist'): @@ -483,7 +483,7 @@ class TimelineHandler(object): # Schedule a callback to clear the recently added queue schedule_callback('rating_key-{}'.format(rating_key), func=clear_recently_added_queue, - args=[rating_key], + args=[rating_key, title], seconds=plexpy.CONFIG.NOTIFY_RECENTLY_ADDED_DELAY) # A movie, show, or artist is done processing @@ -633,7 +633,10 @@ def force_stop_stream(session_key, title, user): delete_metadata_cache(session_key) -def clear_recently_added_queue(rating_key): +def clear_recently_added_queue(rating_key, title): + logger.debug("Tautulli TimelineHandler :: Starting callback for library item '%s' (%s) after delay.", + title, str(rating_key)) + child_keys = RECENTLY_ADDED_QUEUE[rating_key] if plexpy.CONFIG.NOTIFY_GROUP_RECENTLY_ADDED_GRANDPARENT and len(child_keys) > 1: @@ -661,10 +664,12 @@ def clear_recently_added_queue(rating_key): def on_created(rating_key, **kwargs): - logger.debug("Tautulli TimelineHandler :: Library item %s added to Plex." % str(rating_key)) pms_connect = pmsconnect.PmsConnect() metadata = pms_connect.get_metadata_details(rating_key) + logger.debug("Tautulli TimelineHandler :: Library item '%s' (%s) added to Plex.", + metadata['full_title'], str(rating_key)) + if metadata: notify = True # now = helpers.timestamp() diff --git a/plexpy/pmsconnect.py b/plexpy/pmsconnect.py index 4f893beb..370da5ad 100644 --- a/plexpy/pmsconnect.py +++ b/plexpy/pmsconnect.py @@ -891,7 +891,7 @@ class PmsConnect(object): 'collections': show_details.get('collections', []), 'guids': show_details.get('guids', []), 'full_title': '{} - {}'.format(helpers.get_xml_attr(metadata_main, 'parentTitle'), - helpers.get_xml_attr(metadata_main, 'title')), + helpers.get_xml_attr(metadata_main, 'title')), 'children_count': helpers.cast_to_int(helpers.get_xml_attr(metadata_main, 'leafCount')), 'live': int(helpers.get_xml_attr(metadata_main, 'live') == '1') } @@ -964,7 +964,7 @@ class PmsConnect(object): 'collections': show_details.get('collections', []), 'guids': show_details.get('guids', []), 'full_title': '{} - {}'.format(helpers.get_xml_attr(metadata_main, 'grandparentTitle'), - helpers.get_xml_attr(metadata_main, 'title')), + helpers.get_xml_attr(metadata_main, 'title')), 'children_count': helpers.cast_to_int(helpers.get_xml_attr(metadata_main, 'leafCount')), 'live': int(helpers.get_xml_attr(metadata_main, 'live') == '1') } @@ -1065,7 +1065,7 @@ class PmsConnect(object): 'collections': collections, 'guids': guids, 'full_title': '{} - {}'.format(helpers.get_xml_attr(metadata_main, 'parentTitle'), - helpers.get_xml_attr(metadata_main, 'title')), + helpers.get_xml_attr(metadata_main, 'title')), 'children_count': helpers.cast_to_int(helpers.get_xml_attr(metadata_main, 'leafCount')), 'live': int(helpers.get_xml_attr(metadata_main, 'live') == '1') } @@ -1119,7 +1119,7 @@ class PmsConnect(object): 'collections': album_details.get('collections', []), 'guids': album_details.get('guids', []), 'full_title': '{} - {}'.format(helpers.get_xml_attr(metadata_main, 'title'), - track_artist), + track_artist), 'children_count': helpers.cast_to_int(helpers.get_xml_attr(metadata_main, 'leafCount')), 'live': int(helpers.get_xml_attr(metadata_main, 'live') == '1') } @@ -1220,7 +1220,7 @@ class PmsConnect(object): 'collections': photo_album_details.get('collections', []), 'guids': photo_album_details.get('guids', []), 'full_title': '{} - {}'.format(helpers.get_xml_attr(metadata_main, 'parentTitle') or library_name, - helpers.get_xml_attr(metadata_main, 'title')), + helpers.get_xml_attr(metadata_main, 'title')), 'children_count': helpers.cast_to_int(helpers.get_xml_attr(metadata_main, 'leafCount')), 'live': int(helpers.get_xml_attr(metadata_main, 'live') == '1') }