diff --git a/plexpy/common.py b/plexpy/common.py index 5dc239da..840beefd 100644 --- a/plexpy/common.py +++ b/plexpy/common.py @@ -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'}, diff --git a/plexpy/notification_handler.py b/plexpy/notification_handler.py index 2d8ec6a1..4ae81d1a 100644 --- a/plexpy/notification_handler.py +++ b/plexpy/notification_handler.py @@ -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'],