Add season_name notification parameter

This commit is contained in:
JonnyWong16 2021-03-04 17:26:48 -08:00
commit 390391c750
No known key found for this signature in database
GPG key ID: B1F1F9807184697A
4 changed files with 17 additions and 8 deletions

View file

@ -468,7 +468,8 @@ NOTIFICATION_PARAMETERS = [
{'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': 'Episode Name', 'type': 'str', 'value': 'episode_name', 'description': 'The title of the episode.'},
{'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.'},
{'name': 'Album Name', 'type': 'str', 'value': 'album_name', 'description': 'The title of the album.'},
{'name': 'Track Name', 'type': 'str', 'value': 'track_name', 'description': 'The title of the track.'},

View file

@ -781,6 +781,7 @@ def build_media_notify_params(notify_action=None, session=None, timeline=None, m
if ((manual_trigger or plexpy.CONFIG.NOTIFY_GROUP_RECENTLY_ADDED_GRANDPARENT)
and notify_params['media_type'] in ('show', 'artist')):
show_name = notify_params['title']
season_name = ''
episode_name = ''
artist_name = notify_params['title']
album_name = ''
@ -800,6 +801,7 @@ def build_media_notify_params(notify_action=None, session=None, timeline=None, m
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']
season_name = notify_params['title']
episode_name = ''
artist_name = notify_params['parent_title']
album_name = notify_params['title']
@ -819,6 +821,7 @@ def build_media_notify_params(notify_action=None, session=None, timeline=None, m
else:
show_name = notify_params['grandparent_title']
season_name = notify_params['parent_title']
episode_name = notify_params['title']
artist_name = notify_params['grandparent_title']
album_name = notify_params['parent_title']
@ -982,6 +985,7 @@ def build_media_notify_params(notify_action=None, session=None, timeline=None, m
'title': notify_params['full_title'],
'library_name': notify_params['library_name'],
'show_name': show_name,
'season_name': season_name,
'episode_name': episode_name,
'artist_name': artist_name,
'album_name': album_name,

View file

@ -765,13 +765,17 @@ class PrettyMetadata(object):
elif self.media_type == 'show':
title = '%s (%s)' % (self.parameters['show_name'], self.parameters['year'])
elif self.media_type == 'season':
title = '%s - Season %s' % (self.parameters['show_name'], self.parameters['season_num'])
title = '%s - %s' % (self.parameters['show_name'], self.parameters['season_name'])
elif self.media_type == 'episode':
title = '%s - %s (S%s %s E%s)' % (self.parameters['show_name'],
self.parameters['episode_name'],
self.parameters['season_num'],
divider,
self.parameters['episode_num'])
if self.parameters['season_name'].startswith('Season '):
season = 'S%s' % self.parameters['season_num']
else:
season = self.parameters['season_name']
title = '%s - %s (%s %s E%s)' % (self.parameters['show_name'],
self.parameters['episode_name'],
season,
divider,
self.parameters['episode_num'])
elif self.media_type == 'artist':
title = self.parameters['artist_name']
elif self.media_type == 'album':

View file

@ -925,7 +925,7 @@ class PmsConnect(object):
'parent_rating_key': parent_rating_key,
'grandparent_rating_key': helpers.get_xml_attr(metadata_main, 'grandparentRatingKey'),
'title': helpers.get_xml_attr(metadata_main, 'title'),
'parent_title': 'Season %s' % helpers.get_xml_attr(metadata_main, 'parentIndex'),
'parent_title': helpers.get_xml_attr(metadata_main, 'parentTitle'),
'grandparent_title': helpers.get_xml_attr(metadata_main, 'grandparentTitle'),
'original_title': helpers.get_xml_attr(metadata_main, 'originalTitle'),
'sort_title': helpers.get_xml_attr(metadata_main, 'titleSort'),