Update rating notification parameters for new Plex Movie agent

This commit is contained in:
JonnyWong16 2020-10-23 17:46:11 -07:00
parent 62cc2f769f
commit 0209fa87aa
No known key found for this signature in database
GPG key ID: B1F1F9807184697A
2 changed files with 11 additions and 5 deletions

View file

@ -501,7 +501,8 @@ NOTIFICATION_PARAMETERS = [
{'name': 'Tagline', 'type': 'str', 'value': 'tagline', 'description': 'A tagline for the media item.'},
{'name': 'Rating', 'type': 'float', 'value': 'rating', 'description': 'The rating (out of 10) for the item.'},
{'name': 'Critic Rating', 'type': 'int', 'value': 'critic_rating', 'description': 'The critic rating (%) for the item.', 'help_text': 'Ratings source must be Rotten Tomatoes for the Plex Movie agent'},
{'name': 'Audience Rating', 'type': 'int', 'value': 'audience_rating', 'description': 'The audience rating (%) for the item.', 'help_text': 'Ratings source must be Rotten Tomatoes for the Plex Movie agent'},
{'name': 'Audience Rating', 'type': 'float', 'value': 'audience_rating', 'description': 'The audience rating for the item.', 'help_text': 'Rating out of 10 for IMDB, percentage (%) for Rotten Tomatoes and TMDB.'},
{'name': 'User Rating', 'type': 'float', 'value': 'user_rating', 'description': 'The user (star) rating (out of 10) for the item.'},
{'name': 'Duration', 'type': 'int', 'value': 'duration', 'description': 'The duration (in minutes) for the item.'},
{'name': 'Poster URL', 'type': 'str', 'value': 'poster_url', 'description': 'A URL for the movie, TV show, or album poster.'},
{'name': 'Plex ID', 'type': 'str', 'value': 'plex_id', 'description': 'The Plex ID for the item.', 'example': 'e.g. 5d7769a9594b2b001e6a6b7e'},

View file

@ -831,12 +831,16 @@ def build_media_notify_params(notify_action=None, session=None, timeline=None, m
child_count = 1
grandchild_count = 1
rating = notify_params['rating'] or notify_params['audience_rating']
critic_rating = ''
if notify_params['rating_image'].startswith('rottentomatoes://') and notify_params['rating']:
if notify_params['rating_image'].startswith('rottentomatoes://') \
and notify_params['rating']:
critic_rating = helpers.get_percent(notify_params['rating'], 10)
audience_rating = ''
if notify_params['audience_rating']:
audience_rating = notify_params['audience_rating']
if notify_params['audience_rating_image'].startswith(('rottentomatoes://', 'themoviedb://')) \
and audience_rating:
audience_rating = helpers.get_percent(notify_params['audience_rating'], 10)
now = arrow.now()
@ -1013,9 +1017,10 @@ def build_media_notify_params(notify_action=None, session=None, timeline=None, m
'collections': ', '.join(notify_params['collections']),
'summary': notify_params['summary'],
'tagline': notify_params['tagline'],
'rating': notify_params['rating'],
'rating': rating,
'critic_rating': critic_rating,
'audience_rating': audience_rating,
'user_rating': notify_params['user_rating'],
'duration': duration,
'poster_title': notify_params['poster_title'],
'poster_url': notify_params['poster_url'],