From 9f1b7de623bdb98ac9ab53de6e99a278b8428a47 Mon Sep 17 00:00:00 2001 From: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com> Date: Thu, 14 Jul 2022 18:45:00 -0700 Subject: [PATCH] Add show_year notification parameter --- plexpy/common.py | 3 ++- plexpy/notification_handler.py | 6 ++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/plexpy/common.py b/plexpy/common.py index 1312d98f..b89ef48a 100644 --- a/plexpy/common.py +++ b/plexpy/common.py @@ -491,7 +491,7 @@ NOTIFICATION_PARAMETERS = [ {'name': 'Media Type', 'type': 'str', 'value': 'media_type', 'description': 'The type of media.', 'example': 'movie, show, season, episode, artist, album, track, clip'}, {'name': 'Title', 'type': 'str', 'value': 'title', 'description': 'The full title of the item.'}, {'name': 'Library Name', 'type': 'str', 'value': 'library_name', 'description': 'The library name of the item.'}, - {'name': 'Show Name', 'type': 'str', 'value': 'show_name', 'description': 'The title of the TV series.'}, + {'name': 'Show Name', 'type': 'str', 'value': 'show_name', 'description': 'The title of the TV show.'}, {'name': 'Season Name', 'type': 'str', 'value': 'season_name', 'description': 'The title of the TV season.'}, {'name': 'Episode Name', 'type': 'str', 'value': 'episode_name', 'description': 'The title of the TV episode.'}, {'name': 'Artist Name', 'type': 'str', 'value': 'artist_name', 'description': 'The name of the artist.'}, @@ -511,6 +511,7 @@ NOTIFICATION_PARAMETERS = [ {'name': 'Album Count', 'type': 'int', 'value': 'album_count', 'description': 'The number of albums in a grouped recently added notification.'}, {'name': 'Track Count', 'type': 'int', 'value': 'track_count', 'description': 'The number of tracks in a grouped recently added notification.'}, {'name': 'Year', 'type': 'int', 'value': 'year', 'description': 'The release year for the item.'}, + {'name': 'Show Year', 'type': 'int', 'value': 'show_year', 'description': 'The release year of the TV show.'}, {'name': 'Release Date', 'type': 'str', '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.'}, {'name': 'Added Date', 'type': 'str', 'value': 'added_date', 'description': 'The date (in date format) the item was added to Plex.'}, diff --git a/plexpy/notification_handler.py b/plexpy/notification_handler.py index 97e0ba1a..497973be 100644 --- a/plexpy/notification_handler.py +++ b/plexpy/notification_handler.py @@ -862,6 +862,8 @@ def build_media_notify_params(notify_action=None, session=None, timeline=None, m child_count = len(child_num) grandchild_count = '' + show_year = notify_params['year'] + 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'] @@ -885,6 +887,8 @@ def build_media_notify_params(notify_action=None, session=None, timeline=None, m child_count = 1 grandchild_count = len(grandchild_num) + show_year = notify_params['parent_year'] + else: show_name = notify_params['grandparent_title'] season_name = notify_params['parent_title'] @@ -902,6 +906,7 @@ def build_media_notify_params(notify_action=None, session=None, timeline=None, m track_num00 = str(notify_params['media_index']).zfill(2) child_count = 1 grandchild_count = 1 + show_year = notify_params['grandparent_year'] rating = notify_params['rating'] or notify_params['audience_rating'] @@ -1075,6 +1080,7 @@ def build_media_notify_params(notify_action=None, session=None, timeline=None, m 'album_count': child_count, 'track_count': grandchild_count, 'year': notify_params['year'], + 'show_year': show_year, 'release_date': arrow.get(notify_params['originally_available_at']).format(date_format) if notify_params['originally_available_at'] else '', 'air_date': arrow.get(notify_params['originally_available_at']).format(date_format)