diff --git a/plexpy/common.py b/plexpy/common.py index 249309e3..553b85d9 100644 --- a/plexpy/common.py +++ b/plexpy/common.py @@ -391,6 +391,10 @@ NOTIFICATION_PARAMETERS = [ {'name': 'Episode Number 00', 'type': 'int', 'value': 'episode_num00', 'description': 'The two digit episode number.', 'example': 'e.g. 06, or 06-10'}, {'name': 'Track Number', 'type': 'int', 'value': 'track_num', 'description': 'The track number.', 'example': 'e.g. 4, or 4-10'}, {'name': 'Track Number 00', 'type': 'int', 'value': 'track_num00', 'description': 'The two digit track number.', 'example': 'e.g. 04, or 04-10'}, + {'name': 'Season Count', 'type': 'int', 'value': 'season_count', 'description': 'The number of seasons.'}, + {'name': 'Episode Count', 'type': 'int', 'value': 'episode_count', 'description': 'The number of episodes.'}, + {'name': 'Album Count', 'type': 'int', 'value': 'album_count', 'description': 'The number of albums.'}, + {'name': 'Track Count', 'type': 'int', 'value': 'track_count', 'description': 'The number of tracks.'}, {'name': 'Year', 'type': 'int', 'value': 'year', 'description': 'The release year for the item.'}, {'name': 'Release Date', 'type': 'int', 'value': 'release_date', 'description': 'The release date (in date format) for the item.'}, {'name': 'Air Date', 'type': 'str', 'value': 'air_date', 'description': 'The air date (in date format) for the item.'}, diff --git a/plexpy/notification_handler.py b/plexpy/notification_handler.py index fe9496c8..45a064fe 100644 --- a/plexpy/notification_handler.py +++ b/plexpy/notification_handler.py @@ -640,13 +640,17 @@ def build_media_notify_params(notify_action=None, session=None, timeline=None, m album_name = '' track_name = '' - num, num00 = format_group_index([helpers.cast_to_int(d['media_index']) - for d in child_metadata if d['parent_rating_key'] == rating_key]) + child_num = [helpers.cast_to_int( + d['media_index']) for d in child_metadata if d['parent_rating_key'] == rating_key] + num, num00 = format_group_index(child_num) season_num, season_num00 = num, num00 episode_num, episode_num00 = '', '' track_num, track_num00 = '', '' + child_count = len(child_num) + grandchild_count = '' + elif ((manual_trigger or plexpy.CONFIG.NOTIFY_GROUP_RECENTLY_ADDED_PARENT) and notify_params['media_type'] in ('season', 'album')): show_name = notify_params['parent_title'] @@ -654,14 +658,19 @@ def build_media_notify_params(notify_action=None, session=None, timeline=None, m artist_name = notify_params['parent_title'] album_name = notify_params['title'] track_name = '' + season_num = str(notify_params['media_index']).zfill(1) season_num00 = str(notify_params['media_index']).zfill(2) - num, num00 = format_group_index([helpers.cast_to_int(d['media_index']) - for d in child_metadata if d['parent_rating_key'] == rating_key]) + grandchild_num = [helpers.cast_to_int( + d['media_index']) for d in child_metadata if d['parent_rating_key'] == rating_key] + num, num00 = format_group_index(grandchild_num) episode_num, episode_num00 = num, num00 track_num, track_num00 = num, num00 + child_count = 1 + grandchild_count = len(grandchild_num) + else: show_name = notify_params['grandparent_title'] episode_name = notify_params['title'] @@ -674,6 +683,8 @@ def build_media_notify_params(notify_action=None, session=None, timeline=None, m episode_num00 = str(notify_params['media_index']).zfill(2) track_num = str(notify_params['media_index']).zfill(1) track_num00 = str(notify_params['media_index']).zfill(2) + child_count = 1 + grandchild_count = 1 available_params = { # Global paramaters @@ -783,6 +794,10 @@ def build_media_notify_params(notify_action=None, session=None, timeline=None, m 'episode_num00': episode_num00, 'track_num': track_num, 'track_num00': track_num00, + 'season_count': child_count, + 'episode_count': grandchild_count, + 'album_count': child_count, + 'track_count': grandchild_count, 'year': notify_params['year'], 'release_date': arrow.get(notify_params['originally_available_at']).format(date_format) if notify_params['originally_available_at'] else '',