Add stream details to notification options

* Also beautify modal
This commit is contained in:
Jonathan Wong 2015-12-12 17:31:52 -08:00
parent 53876e8f0d
commit 66bb922012
3 changed files with 296 additions and 127 deletions

View file

@ -2521,3 +2521,28 @@ table[id^='history_child'] thead th {
-o-transition: background 0.3s;
transition: background 0.3s;
}
.notification-params {
margin-top: 10px;
background-color: #282828;
}
.notification-params th {
padding-left: 10px;
height: 30px;
}
.notification-params td {
height: 25px;
}
.notification-params td:first-child {
padding-left: 10px;
width: 200px;
}
.notification-params td:not(:first-child) {
padding-right: 10px;
}
.notification-params tr:nth-child(odd) td {
background-color: rgba(255,255,255,0.035);
}
.notification-params tr:nth-child(even) td {
background-color: rgba(255,255,255,0.010);
}

View file

@ -930,155 +930,248 @@ available_notification_agents = sorted(notifiers.available_notification_agents()
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i
class="fa fa-remove"></i></button>
<h4 class="modal-title">Notification string substitutions</h4>
<h4 class="modal-title">Notification String Substitutions</h4>
</div>
<div class="modal-body">
<div>
<p class="help-block">
If a value for a selected parameter cannot be provided nothing will be outputted for it.
If the value for a selected parameter cannot be provided, it will display as blank.
</p>
<table>
<table class="notification-params">
<thead>
<tr>
<th>
Server Details
</th>
</tr>
</thead>
<tbody>
<tr>
<td width="150"><strong>{server_name}</strong></td>
<td><strong>{server_name}</strong></td>
<td>The name of your Plex Server.</td>
</tr>
<tr>
<td width="150"><strong>{server_uptime}</strong></td>
<td><strong>{server_uptime}</strong></td>
<td>The uptime (in days, hours, mins, secs) of your Plex Server.</td>
</tr>
</tbody>
</table>
<table class="notification-params">
<thead>
<tr>
<td width="150"><strong>{user}</strong></td>
<th>
Stream Details
</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>{user}</strong></td>
<td>The username of the person streaming.</td>
</tr>
<tr>
<td width="150"><strong>{platform}</strong></td>
<td><strong>{platform}</strong></td>
<td>The type of client being used for playback.</td>
</tr>
<tr>
<td width="150"><strong>{player}</strong></td>
<td><strong>{player}</strong></td>
<td>The name of the device being used for playback.</td>
</tr>
<tr>
<td width="150"><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>
</tr>
<tr>
<td width="150"><strong>{media_type}</strong></td>
<td><strong>{media_type}</strong></td>
<td>The type of media being played (movie, episode, track).</td>
</tr>
<tr>
<td width="150"><strong>{title}</strong></td>
<td>The full title of the item being played.</td>
</tr>
<tr>
<td width="150"><strong>{show_name}</strong></td>
<td>The title of the TV series being played.</td>
</tr>
<tr>
<td width="150"><strong>{episode_name}</strong></td>
<td>The title of the episode being played.</td>
</tr>
<tr>
<td width="150"><strong>{artist_name}</strong></td>
<td>The name of the artist being played.</td>
</tr>
<tr>
<td width="150"><strong>{album_name}</strong></td>
<td>The title of the album being played.</td>
</tr>
<tr>
<td width="150"><strong>{track_name}</strong></td>
<td>The title of the track being played.</td>
</tr>
<tr>
<td width="150"><strong>{season_num}</strong></td>
<td>The season number for the media item if item is episode.</td>
</tr>
<tr>
<td width="150"><strong>{season_num00}</strong></td>
<td>The two digit season number.</td>
</tr>
<tr>
<td width="150"><strong>{episode_num}</strong></td>
<td>The episode number for the media item if item is episode.</td>
</tr>
<tr>
<td width="150"><strong>{episode_num00}</strong></td>
<td>The two digit episode number.</td>
</tr>
<tr>
<td width="150"><strong>{video_decision}</strong></td>
<td>The video transcode decisions for the media item.</td>
</tr>
<tr>
<td width="150"><strong>{audio_decision}</strong></td>
<td>The audio transcode decisions for the media item.</td>
</tr>
<tr>
<td width="150"><strong>{transcode_decision}</strong></td>
<td>The stream transcode decisions for the media item.</td>
</tr>
<tr>
<td width="150"><strong>{year}</strong></td>
<td>The release year for the media item.</td>
</tr>
<tr>
<td width="150"><strong>{studio}</strong></td>
<td>The studio for the media item.</td>
</tr>
<tr>
<td width="150"><strong>{content_rating}</strong></td>
<td>The content rating for the media item. (e.g. TV-MA, TV-PG, etc.)</td>
</tr>
<tr>
<td width="150"><strong>{directors}</strong></td>
<td>A list of directors for the media item.</td>
</tr>
<tr>
<td width="150"><strong>{writers}</strong></td>
<td>A list of writers for the media item.</td>
</tr>
<tr>
<td width="150"><strong>{actors}</strong></td>
<td>A list of actors for the media item.</td>
</tr>
<tr>
<td width="150"><strong>{genres}</strong></td>
<td>A list of genres for the media item.</td>
</tr>
<tr>
<td width="150"><strong>{summary}</strong></td>
<td>A short plot summary for the media item.</td>
</tr>
<tr>
<td width="150"><strong>{tagline}</strong></td>
<td>A tagline for the media item.</td>
</tr>
<tr>
<td width="150"><strong>{rating}</strong></td>
<td>The rating (out of 10) for the item.</td>
</tr>
<tr>
<td width="150"><strong>{duration}</strong></td>
<td>The duration (in minutes) for the item.</td>
</tr>
<tr>
<td width="150"><strong>{stream_duration}</strong></td>
<td><strong>{stream_duration}</strong></td>
<td>The stream duration (in minutes) for the item.</td>
</tr>
<tr>
<td width="150"><strong>{remaining_duration}</strong></td>
<td><strong>{remaining_duration}</strong></td>
<td>The remaining duration (in minutes) for the item.</td>
</tr>
<tr>
<td width="150"><strong>{progress}</strong></td>
<td><strong>{progress}</strong></td>
<td>The last reported offset (in minutes) for the item.</td>
</tr>
<tr>
<td width="150"><strong>{progress_percent}</strong></td>
<td><strong>{progress_percent}</strong></td>
<td>The last reported progress percent for the item.</td>
</tr>
<tr>
<td><strong>{container}</strong></td>
<td>The media container of the original media.</td>
</tr>
<tr>
<td><strong>{video_codec}</strong></td>
<td>The video codec of the original media.</td>
</tr>
<tr>
<td><strong>{video_bitrate}</strong></td>
<td>The video bitrate of the original media.</td>
</tr>
<tr>
<td><strong>{video_width}</strong></td>
<td>The video width of the original media.</td>
</tr>
<tr>
<td><strong>{video_height}</strong></td>
<td>The video height of the original media.</td>
</tr>
<tr>
<td><strong>{video_resolution}</strong></td>
<td>The video resolution of the original media.</td>
</tr>
<tr>
<td><strong>{video_framerate}</strong></td>
<td>The video framerate of the original media.</td>
</tr>
<tr>
<td><strong>{aspect_ratio}</strong></td>
<td>The aspect ratio of the original media.</td>
</tr>
<tr>
<td><strong>{audio_codec}</strong></td>
<td>The audio codec of the original media.</td>
</tr>
<tr>
<td><strong>{audio_channels}</strong></td>
<td>The audio channels of the original media.</td>
</tr>
<tr>
<td><strong>{transcode_decision}</strong></td>
<td>The stream transcode decisions for the media item.</td>
</tr>
<tr>
<td><strong>{video_decision}</strong></td>
<td>The video transcode decisions for the media item.</td>
</tr>
<tr>
<td><strong>{audio_decision}</strong></td>
<td>The audio transcode decisions for the media item.</td>
</tr>
<tr>
<td><strong>{transcode_container}</strong></td>
<td>The media container of the transcoded media.</td>
</tr>
<tr>
<td><strong>{transcode_video_codec}</strong></td>
<td>The video codec of the transcoded media.</td>
</tr>
<tr>
<td><strong>{transcode_video_width}</strong></td>
<td>The video width of the transcoded media.</td>
</tr>
<tr>
<td><strong>{transcode_video_height}</strong></td>
<td>The video height of the transcoded media.</td>
</tr>
<tr>
<td><strong>{transcode_audio_codec}</strong></td>
<td>The audio codec of the transcoded media.</td>
</tr>
<tr>
<td><strong>{transcode_audio_channels}</strong></td>
<td>The audio channels of the transcoded media.</td>
</tr>
</tbody>
</table>
<table class="notification-params">
<thead>
<tr>
<th>
Metadata Details
</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>{title}</strong></td>
<td>The full title of the item being played.</td>
</tr>
<tr>
<td><strong>{show_name}</strong></td>
<td>The title of the TV series being played.</td>
</tr>
<tr>
<td><strong>{episode_name}</strong></td>
<td>The title of the episode being played.</td>
</tr>
<tr>
<td><strong>{artist_name}</strong></td>
<td>The name of the artist being played.</td>
</tr>
<tr>
<td><strong>{album_name}</strong></td>
<td>The title of the album being played.</td>
</tr>
<tr>
<td><strong>{track_name}</strong></td>
<td>The title of the track being played.</td>
</tr>
<tr>
<td><strong>{season_num}</strong></td>
<td>The season number for the media item if item is episode.</td>
</tr>
<tr>
<td><strong>{season_num00}</strong></td>
<td>The two digit season number.</td>
</tr>
<tr>
<td><strong>{episode_num}</strong></td>
<td>The episode number for the media item if item is episode.</td>
</tr>
<tr>
<td><strong>{episode_num00}</strong></td>
<td>The two digit episode number.</td>
</tr>
<tr>
<td><strong>{year}</strong></td>
<td>The release year for the media item.</td>
</tr>
<tr>
<td><strong>{studio}</strong></td>
<td>The studio for the media item.</td>
</tr>
<tr>
<td><strong>{content_rating}</strong></td>
<td>The content rating for the media item. (e.g. TV-MA, TV-PG, etc.)</td>
</tr>
<tr>
<td><strong>{directors}</strong></td>
<td>A list of directors for the media item.</td>
</tr>
<tr>
<td><strong>{writers}</strong></td>
<td>A list of writers for the media item.</td>
</tr>
<tr>
<td><strong>{actors}</strong></td>
<td>A list of actors for the media item.</td>
</tr>
<tr>
<td><strong>{genres}</strong></td>
<td>A list of genres for the media item.</td>
</tr>
<tr>
<td><strong>{summary}</strong></td>
<td>A short plot summary for the media item.</td>
</tr>
<tr>
<td><strong>{tagline}</strong></td>
<td>A tagline for the media item.</td>
</tr>
<tr>
<td><strong>{rating}</strong></td>
<td>The rating (out of 10) for the item.</td>
</tr>
<tr>
<td><strong>{duration}</strong></td>
<td>The duration (in minutes) for the item.</td>
</tr>
</tbody>
</table>
</div>
@ -1092,7 +1185,7 @@ available_notification_agents = sorted(notifiers.available_notification_agents()
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"><i class="fa fa-remove"></i></button>
<h4 class="modal-title">Notification exclusion tags</h4>
<h4 class="modal-title">Notification Exclusion Tags</h4>
</div>
<div class="modal-body">
<div>
@ -1101,21 +1194,24 @@ available_notification_agents = sorted(notifiers.available_notification_agents()
</div>
<div>
<p class="help-block">All text inside a <strong>movie</strong> tag will only be sent when the media item being played back is a movie.</p>
<pre>Example: {user} has started playing {title} &lt;movie&gt;({year})&lt;/movie&gt;</pre>
<p><strong style="color: #fff;">Example:</strong></p>
<pre>{user} has started playing {title} &lt;movie&gt;({year})&lt;/movie&gt;</pre>
</div>
<div class="wellheader">
<h4>TV Tag <strong>&lt;tv&gt;&lt;/tv&gt;</strong></h4>
</div>
<div>
<p class="help-block">All text inside a <strong>tv</strong> tag will only be sent when the media item being played back is an episode.</p>
<pre>Example: {user} has started playing {title} &lt;tv&gt;(S{season_num}E{episode_num})&lt;/tv&gt;</pre>
<p><strong style="color: #fff;">Example:</strong></p>
<pre>{user} has started playing {title} &lt;tv&gt;(S{season_num}E{episode_num})&lt;/tv&gt;</pre>
</div>
<div class="wellheader">
<h4>Music Tag <strong>&lt;music&gt;&lt;/music&gt;</strong></h4>
</div>
<div>
<p class="help-block">All text inside a <strong>music</strong> tag will only be sent when the media item being played back is a music track.</p>
<pre>Example: {user} has started playing {title} &lt;music&gt;(Track {episode_num})&lt;/music&gt;</pre>
<p><strong style="color: #fff;">Example:</strong></p>
<pre>{user} has started playing {title} &lt;music&gt;(Track {episode_num})&lt;/music&gt;</pre>
</div>
</div>
</div>

View file

@ -370,15 +370,31 @@ def build_notify_text(session=None, timeline=None, state=None):
duration = helpers.convert_milliseconds_to_minutes(metadata['duration'])
# Default values
video_decision = ''
audio_decision = ''
transcode_decision = ''
stream_duration = 0
view_offset = 0
user = ''
platform = ''
player = ''
ip_address = 'N/A'
stream_duration = 0
view_offset = 0
container = ''
video_codec = ''
video_bitrate = ''
video_width = ''
video_height = ''
video_resolution = ''
video_framerate = ''
aspect_ratio = ''
audio_codec = ''
audio_channels = ''
transcode_decision = ''
video_decision = ''
audio_decision = ''
transcode_container = ''
transcode_video_codec = ''
transcode_video_width = ''
transcode_video_height = ''
transcode_audio_codec = ''
transcode_audio_channels = ''
# Session values
if session:
@ -405,6 +421,22 @@ def build_notify_text(session=None, timeline=None, state=None):
platform = session['platform']
player = session['player']
ip_address = session['ip_address'] if session['ip_address'] else 'N/A'
container = session['container']
video_codec = session['video_codec']
video_bitrate = session['bitrate']
video_width = session['width']
video_height = session['height']
video_resolution = session['video_resolution']
video_framerate = session['video_framerate']
aspect_ratio = session['aspect_ratio']
audio_codec = session['audio_codec']
audio_channels = session['audio_channels']
transcode_container = session['transcode_container']
transcode_video_codec = session['transcode_video_codec']
transcode_video_width = session['transcode_width']
transcode_video_height = session['transcode_height']
transcode_audio_codec = session['transcode_audio_codec']
transcode_audio_channels = session['transcode_audio_channels']
progress_percent = helpers.get_percent(view_offset, duration)
@ -429,6 +461,29 @@ def build_notify_text(session=None, timeline=None, state=None):
'player': player,
'ip_address': ip_address,
'media_type': metadata['media_type'],
'stream_duration': stream_duration,
'remaining_duration': duration - view_offset,
'progress': view_offset,
'progress_percent': progress_percent,
'container': container,
'video_codec': video_codec,
'video_bitrate': video_bitrate,
'video_width': video_width,
'video_height': video_height,
'video_resolution': video_resolution,
'video_framerate': video_framerate,
'aspect_ratio': aspect_ratio,
'audio_codec': audio_codec,
'audio_channels': audio_channels,
'transcode_decision': transcode_decision,
'video_decision': video_decision,
'audio_decision': audio_decision,
'transcode_container': transcode_container,
'transcode_video_codec': transcode_video_codec,
'transcode_video_width': transcode_video_width,
'transcode_video_height': transcode_video_height,
'transcode_audio_codec': transcode_audio_codec,
'transcode_audio_channels': transcode_audio_channels,
'title': full_title,
'show_name': show_name,
'episode_name': episode_name,
@ -439,9 +494,6 @@ def build_notify_text(session=None, timeline=None, state=None):
'season_num00': metadata['parent_index'].zfill(2),
'episode_num': metadata['index'].zfill(1),
'episode_num00': metadata['index'].zfill(2),
'video_decision': video_decision,
'audio_decision': audio_decision,
'transcode_decision': transcode_decision,
'year': metadata['year'],
'studio': metadata['studio'],
'content_rating': metadata['content_rating'],
@ -452,11 +504,7 @@ def build_notify_text(session=None, timeline=None, state=None):
'summary': metadata['summary'],
'tagline': metadata['tagline'],
'rating': metadata['rating'],
'duration': duration,
'stream_duration': stream_duration,
'remaining_duration': duration - view_offset,
'progress': view_offset,
'progress_percent': progress_percent
'duration': duration
}
# Default subject text