Add IMDB, TVDB, TMDb, last.fm, and trakt to notification options

This commit is contained in:
JonnyWong16 2016-02-09 22:20:17 -08:00
parent 71131c699e
commit 42bfacfb19
3 changed files with 90 additions and 8 deletions

View file

@ -2718,4 +2718,8 @@ table[id^='media_info_child'] table[id^='media_info_child'] thead th {
} }
.selectize-input input[type='text'] { .selectize-input input[type='text'] {
height: 20px; height: 20px;
}
.small-muted {
font-size: small;
color: #777;
} }

View file

@ -1128,7 +1128,7 @@ available_notification_agents = sorted(notifiers.available_notification_agents()
</tr> </tr>
<tr> <tr>
<td><strong>{ip_address}</strong></td> <td><strong>{ip_address}</strong></td>
<td>The IP address of the device being used for playback. (PMS 0.9.14 and above)</td> <td>The IP address of the device being used for playback. <span class="small-muted">(PMS 0.9.14 and above)</span></td>
</tr> </tr>
<tr> <tr>
<td><strong>{stream_duration}</strong></td> <td><strong>{stream_duration}</strong></td>
@ -1291,7 +1291,7 @@ available_notification_agents = sorted(notifiers.available_notification_agents()
</tr> </tr>
<tr> <tr>
<td><strong>{season_num}</strong></td> <td><strong>{season_num}</strong></td>
<td>The season number for the item if item is episode.</td> <td>The season number for the episode.</td>
</tr> </tr>
<tr> <tr>
<td><strong>{season_num00}</strong></td> <td><strong>{season_num00}</strong></td>
@ -1299,7 +1299,7 @@ available_notification_agents = sorted(notifiers.available_notification_agents()
</tr> </tr>
<tr> <tr>
<td><strong>{episode_num}</strong></td> <td><strong>{episode_num}</strong></td>
<td>The episode number for the item if item is episode.</td> <td>The episode number for the episode.</td>
</tr> </tr>
<tr> <tr>
<td><strong>{episode_num00}</strong></td> <td><strong>{episode_num00}</strong></td>
@ -1307,7 +1307,7 @@ available_notification_agents = sorted(notifiers.available_notification_agents()
</tr> </tr>
<tr> <tr>
<td><strong>{track_num}</strong></td> <td><strong>{track_num}</strong></td>
<td>The track number for the item if item is track.</td> <td>The track number for the track.</td>
</tr> </tr>
<tr> <tr>
<td><strong>{track_num00}</strong></td> <td><strong>{track_num00}</strong></td>
@ -1323,7 +1323,7 @@ available_notification_agents = sorted(notifiers.available_notification_agents()
</tr> </tr>
<tr> <tr>
<td><strong>{content_rating}</strong></td> <td><strong>{content_rating}</strong></td>
<td>The content rating for the item. (e.g. TV-MA, TV-PG, etc.)</td> <td>The content rating for the item. <span class="small-muted">(e.g. TV-MA, TV-PG, etc.)</span></td>
</tr> </tr>
<tr> <tr>
<td><strong>{directors}</strong></td> <td><strong>{directors}</strong></td>
@ -1357,21 +1357,60 @@ available_notification_agents = sorted(notifiers.available_notification_agents()
<td><strong>{duration}</strong></td> <td><strong>{duration}</strong></td>
<td>The duration (in minutes) for the item.</td> <td>The duration (in minutes) for the item.</td>
</tr> </tr>
<tr>
<td><strong>{imdb_id}</strong></td>
<td>The IMDB ID for the movie. <span class="small-muted">(e.g. tt2488496)</span>
<p class="small-muted">(PMS agent must be Freebase)</p></td>
</tr>
<tr>
<td><strong>{imdb_url}</strong></td>
<td>The IMDB URL for the movie.
<p class="small-muted">(PMS agent must be Freebase)</p></td>
</tr>
<tr>
<td><strong>{thetvdb_id}</strong></td>
<td>The TVDB ID for the TV show. <span class="small-muted">(e.g. 121361)</span>
<p class="small-muted">(PMS agent must be TheTVDB)</p></td>
</tr>
<tr>
<td><strong>{thetvdb_url}</strong></td>
<td>The TVDB URL for the TV show.
<p class="small-muted">(PMS agent must be TheTVDB)</p></td>
</tr>
<tr>
<td><strong>{themoviedb_id}</strong></td>
<td>The TMDb ID for the movie or TV show. <span class="small-muted">(e.g. 15260)</span>
<p class="small-muted">(PMS agent must be The Movie Database)</p></td>
</tr>
<tr>
<td><strong>{themoviedb_url}</strong></td>
<td>The TMDb URL for the movie or TV show.
<p class="small-muted">(PMS agent must be The Movie Database)</p></td>
</tr>
<tr>
<td><strong>{lastfm_url}</strong></td>
<td>The last.fm URL for the album.
<p class="small-muted">(PMS agent must be Last.fm)</p></td>
</tr>
<tr>
<td><strong>{trakt_url}</strong></td>
<td>The trakt.tv URL for the movie or TV show.</td>
</tr>
<tr> <tr>
<td><strong>{section_id}</strong></td> <td><strong>{section_id}</strong></td>
<td>The unique identifier for the library.</td> <td>The unique identifier for the library.</td>
</tr> </tr>
<tr> <tr>
<td><strong>{rating_key}</strong></td> <td><strong>{rating_key}</strong></td>
<td>The unique identifier for the item.</td> <td>The unique identifier for the movie, episode, or track.</td>
</tr> </tr>
<tr> <tr>
<td><strong>{parent_rating_key}</strong></td> <td><strong>{parent_rating_key}</strong></td>
<td>The unique identifier for the item's parent (season or album).</td> <td>The unique identifier for the season or album.</td>
</tr> </tr>
<tr> <tr>
<td><strong>{grandparent_rating_key}</strong></td> <td><strong>{grandparent_rating_key}</strong></td>
<td>The unique identifier for the item's grandparent (TV show or artist).</td> <td>The unique identifier for the TV show or artist.</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>

View file

@ -457,6 +457,37 @@ def build_notify_text(session=None, timeline=None, state=None):
progress_percent = helpers.get_percent(view_offset, duration) progress_percent = helpers.get_percent(view_offset, duration)
remaining_duration = duration - view_offset remaining_duration = duration - view_offset
# Get media IDs from guid and build URLs
if 'imdb://' in metadata['guid']:
metadata['imdb_id'] = metadata['guid'].split('imdb://')[1].split('?')[0]
metadata['imdb_url'] = 'https://www.imdb.com/title/' + metadata['imdb_id']
metadata['trakt_url'] = 'https://trakt.tv/search/imdb/' + metadata['imdb_id']
if 'thetvdb://' in metadata['guid']:
metadata['thetvdb_id'] = metadata['guid'].split('thetvdb://')[1].split('/')[0]
metadata['thetvdb_url'] = 'https://thetvdb.com/?tab=series&id=' + metadata['thetvdb_id']
metadata['trakt_url'] = 'https://trakt.tv/search/tvdb/' + metadata['thetvdb_id'] + '?id_type=show'
elif 'thetvdbdvdorder://' in metadata['guid']:
metadata['thetvdb_id'] = metadata['guid'].split('thetvdbdvdorder://')[1].split('/')[0]
metadata['thetvdb_url'] = 'https://thetvdb.com/?tab=series&id=' + metadata['thetvdb_id']
metadata['trakt_url'] = 'https://trakt.tv/search/tvdb/' + metadata['thetvdb_id'] + '?id_type=show'
if 'themoviedb://' in metadata['guid']:
if metadata['media_type'] == 'movie':
metadata['themoviedb_id'] = metadata['guid'].split('themoviedb://')[1].split('?')[0]
metadata['themoviedb_url'] = 'https://www.themoviedb.org/movie/' + metadata['themoviedb_id']
metadata['trakt_url'] = 'https://trakt.tv/search/tmdb/' + metadata['themoviedb_id'] + '?id_type=movie'
elif metadata['media_type'] == 'show' or metadata['media_type'] == 'episode':
metadata['themoviedb_id'] = metadata['guid'].split('themoviedb://')[1].split('/')[0]
metadata['themoviedb_url'] = 'https://www.themoviedb.org/tv/' + metadata['themoviedb_id']
metadata['trakt_url'] = 'https://trakt.tv/search/tmdb/' + metadata['themoviedb_id'] + '?id_type=show'
if 'lastfm://' in metadata['guid']:
metadata['lastfm_id'] = metadata['guid'].split('lastfm://')[1].rsplit('/', 1)[0]
metadata['lastfm_url'] = 'https://www.last.fm/music/' + metadata['lastfm_id']
# Fix metadata params for notify recently added grandparent # Fix metadata params for notify recently added grandparent
if state == 'created' and plexpy.CONFIG.NOTIFY_RECENTLY_ADDED_GRANDPARENT: if state == 'created' and plexpy.CONFIG.NOTIFY_RECENTLY_ADDED_GRANDPARENT:
show_name = metadata['title'] show_name = metadata['title']
@ -538,6 +569,14 @@ def build_notify_text(session=None, timeline=None, state=None):
'tagline': metadata['tagline'], 'tagline': metadata['tagline'],
'rating': metadata['rating'], 'rating': metadata['rating'],
'duration': duration, 'duration': duration,
'imdb_id': metadata.get('imdb_id',''),
'imdb_url': metadata.get('imdb_url',''),
'thetvdb_id': metadata.get('thetvdb_id',''),
'thetvdb_url': metadata.get('thetvdb_url',''),
'themoviedb_id': metadata.get('themoviedb_id',''),
'themoviedb_url': metadata.get('themoviedb_url',''),
'lastfm_url': metadata.get('lastfm_url',''),
'trakt_url': metadata.get('trakt_url',''),
'section_id': metadata['section_id'], 'section_id': metadata['section_id'],
'rating_key': metadata['rating_key'], 'rating_key': metadata['rating_key'],
'parent_rating_key': metadata['parent_rating_key'], 'parent_rating_key': metadata['parent_rating_key'],