Notifications for user concurrent streams

This commit is contained in:
JonnyWong16 2016-07-04 22:47:59 -07:00
parent f77538f179
commit 0b085b6d03
8 changed files with 200 additions and 26 deletions

View file

@ -57,6 +57,13 @@
</label> </label>
<p class="help-block">Trigger notification when a media item triggers the defined buffer threshold.</p> <p class="help-block">Trigger notification when a media item triggers the defined buffer threshold.</p>
</div> </div>
<div class="checkbox">
<label>
<input type="checkbox" data-size="small" data-id="${data['id']}" data-config-name="${data['config_prefix']}_on_concurrent" ${helpers.checked(data['on_concurrent'])} class="toggle-switches">
Notify on user concurrent stream
</label>
<p class="help-block">Trigger notification when a user has concurrent streams.</p>
</div>
<div class="checkbox"> <div class="checkbox">
<label> <label>
<input type="checkbox" data-size="small" data-id="${data['id']}" data-config-name="${data['config_prefix']}_on_created" ${helpers.checked(data['on_created'])} class="toggle-switches"> <input type="checkbox" data-size="small" data-id="${data['id']}" data-config-name="${data['config_prefix']}_on_created" ${helpers.checked(data['on_created'])} class="toggle-switches">

View file

@ -302,7 +302,7 @@
</div> </div>
<div id="home_stats_count_error" class="alert alert-danger settings-alert" role="alert"></div> <div id="home_stats_count_error" class="alert alert-danger settings-alert" role="alert"></div>
</div> </div>
<p class="help-block">Specify the number of items to show in the top lists for the watch statistics on the home page. Max is 10 items, default is 5 items, 0 to disable.</p> <p class="help-block">Specify the number of items to show in the top lists for the watch statistics on the home page. Maximum 10 items, default 5 items, 0 to disable.</p>
</div> </div>
<div class="checkbox"> <div class="checkbox">
<label> <label>
@ -740,7 +740,7 @@
</div> </div>
<div id="monitoring_interval_error" class="alert alert-danger settings-alert" role="alert"></div> <div id="monitoring_interval_error" class="alert alert-danger settings-alert" role="alert"></div>
</div> </div>
<p class="help-block">The interval (in seconds) PlexPy will ping your Plex Server. Min 30 seconds, recommended 60 seconds.</p> <p class="help-block">The interval (in seconds) PlexPy will ping your Plex Server. Minimum 30 seconds, recommended 60 seconds.</p>
</div> </div>
<div class="checkbox"> <div class="checkbox">
<label> <label>
@ -882,6 +882,22 @@
</label> </label>
<p class="help-block">Disable to prevent consecutive notifications (i.e. both watched &amp; stopped notifications).</p> <p class="help-block">Disable to prevent consecutive notifications (i.e. both watched &amp; stopped notifications).</p>
</div> </div>
<div class="checkbox">
<label>
<input type="checkbox" name="notify_concurrent_by_ip" id="notify_concurrent_by_ip" value="1" ${config['notify_concurrent_by_ip']}> User Concurrent Streams Notifications by IP Address
</label>
<p class="help-block">Enable to only get notified of concurrent streams by a single user from different IP addresses.</p>
</div>
<div class="form-group">
<label for="notify_concurrent_threshold">User Concurrent Stream Threshold</label>
<div class="row">
<div class="col-md-2">
<input type="text" class="form-control" data-parsley-type="integer" id="notify_concurrent_threshold" name="notify_concurrent_threshold" value="${config['notify_concurrent_threshold']}" data-parsley-min="2" data-parsley-trigger="change" data-parsley-errors-container="#notify_concurrent_threshold_error" required>
</div>
<div id="notify_concurrent_threshold_error" class="alert alert-danger settings-alert" role="alert"></div>
</div>
<p class="help-block">The number of concurrent streams by a single user for PlexPy to trigger a notification. Minimum 2.</p>
</div>
<div class="padded-header"> <div class="padded-header">
<h3>Recently Added Notifications</h3> <h3>Recently Added Notifications</h3>
@ -1026,6 +1042,23 @@
</li> </li>
</ul> </ul>
</li> </li>
<li>
<div class="link"><i class="fa fa-arrow-circle-o-right fa-fw"></i>&nbsp;User Concurrent Streams<i class="fa fa-chevron-down"></i></div>
<ul class="submenu">
<li>
<div class="form-group">
<label for="notify_on_concurrent_subject_text">Subject Line</label>
<input class="form-control" type="text" id="notify_on_concurrent_subject_text" name="notify_on_concurrent_subject_text" value="${config['notify_on_concurrent_subject_text']}" data-parsley-trigger="change" required>
<p class="help-block">Set a custom subject line.</p>
</div>
<div class="form-group">
<label for="notify_on_buffer_body_text">Message Body</label>
<textarea class="form-control" id="notify_on_concurrent_body_text" name="notify_on_concurrent_body_text" data-parsley-trigger="change" data-autoresize required>${config['notify_on_concurrent_body_text']}</textarea>
<p class="help-block">Set a custom body.</p>
</div>
</li>
</ul>
</li>
</ul> </ul>
<ul id="accordion-timeline" class="accordion list-unstyled"> <ul id="accordion-timeline" class="accordion list-unstyled">
<li> <li>
@ -1562,6 +1595,10 @@
<td><strong>{streams}</strong></td> <td><strong>{streams}</strong></td>
<td>The number of concurrent streams.</td> <td>The number of concurrent streams.</td>
</tr> </tr>
<tr>
<td><strong>{user_streams}</strong></td>
<td>The number of concurrent streams by the person streaming.</td>
</tr>
<tr> <tr>
<td><strong>{user}</strong></td> <td><strong>{user}</strong></td>
<td>The friendly name of the person streaming.</td> <td>The friendly name of the person streaming.</td>

View file

@ -55,23 +55,36 @@ class ActivityHandler(object):
return None return None
def update_db_session(self): def update_db_session(self, session=None):
# Update our session temp table values # Update our session temp table values
monitor_proc = activity_processor.ActivityProcessor() monitor_proc = activity_processor.ActivityProcessor()
monitor_proc.write_session(session=self.get_live_session(), notify=False) monitor_proc.write_session(session=session, notify=False)
def on_start(self): def on_start(self):
if self.is_valid_session() and self.get_live_session(): if self.is_valid_session() and self.get_live_session():
logger.debug(u"PlexPy ActivityHandler :: Session %s has started." % str(self.get_session_key())) logger.debug(u"PlexPy ActivityHandler :: Session %s has started." % str(self.get_session_key()))
session = self.get_live_session()
# Check if any notification agents have notifications enabled # Check if any notification agents have notifications enabled
if any(d['on_play'] for d in notifiers.available_notification_agents()): if any(d['on_play'] for d in notifiers.available_notification_agents()):
# Fire off notifications # Fire off notifications
threading.Thread(target=notification_handler.notify, threading.Thread(target=notification_handler.notify,
kwargs=dict(stream_data=self.get_live_session(), notify_action='play')).start() kwargs=dict(stream_data=session, notify_action='play')).start()
# Write the new session to our temp session table # Write the new session to our temp session table
self.update_db_session() self.update_db_session(session=session)
# Check if any notification agents have notifications enabled
if any(d['on_concurrent'] for d in notifiers.available_notification_agents()):
# Check if any concurrent streams by the user
ip = True if plexpy.CONFIG.NOTIFY_CONCURRENT_BY_IP else None
ap = activity_processor.ActivityProcessor()
user_sessions = ap.get_session_by_user_id(user_id=session['user_id'], ip_address=ip)
if len(user_sessions) >= plexpy.CONFIG.NOTIFY_CONCURRENT_THRESHOLD:
# Push any notifications - Push it on it's own thread so we don't hold up our db actions
threading.Thread(target=notification_handler.notify,
kwargs=dict(stream_data=session, notify_action='concurrent')).start()
def on_stop(self, force_stop=False): def on_stop(self, force_stop=False):
if self.is_valid_session(): if self.is_valid_session():

View file

@ -106,6 +106,16 @@ class ActivityProcessor(object):
ip_address = {'ip_address': ip_address} ip_address = {'ip_address': ip_address}
self.db.upsert('sessions', ip_address, keys) self.db.upsert('sessions', ip_address, keys)
# Check if any notification agents have notifications enabled
if notify and any(d['on_concurrent'] for d in notifiers.available_notification_agents()):
# Check if any concurrent streams by the user
ip = True if plexpy.CONFIG.NOTIFY_CONCURRENT_BY_IP else None
user_sessions = self.get_session_by_user_id(user_id=session['user_id'], ip_address=ip)
if len(user_sessions) >= plexpy.CONFIG.NOTIFY_CONCURRENT_THRESHOLD:
# Push any notifications - Push it on it's own thread so we don't hold up our db actions
threading.Thread(target=notification_handler.notify,
kwargs=dict(stream_data=values, notify_action='concurrent')).start()
return True return True
def write_session_history(self, session=None, import_metadata=None, is_import=False, import_ignore_interval=0): def write_session_history(self, session=None, import_metadata=None, is_import=False, import_ignore_interval=0):
@ -470,3 +480,13 @@ class ActivityProcessor(object):
return last_time['buffer_last_triggered'] return last_time['buffer_last_triggered']
return None return None
def get_session_by_user_id(self, user_id=None, ip_address=None):
sessions = []
if str(user_id).isdigit():
ip = 'GROUP BY ip_address' if ip_address else ''
sessions = self.db.select('SELECT * '
'FROM sessions '
'WHERE user_id = ? %s' % ip,
[user_id])
return sessions

View file

@ -80,6 +80,7 @@ _CONFIG_DEFINITIONS = {
'BOXCAR_ON_EXTUP': (int, 'Boxcar', 0), 'BOXCAR_ON_EXTUP': (int, 'Boxcar', 0),
'BOXCAR_ON_INTUP': (int, 'Boxcar', 0), 'BOXCAR_ON_INTUP': (int, 'Boxcar', 0),
'BOXCAR_ON_PMSUPDATE': (int, 'Boxcar', 0), 'BOXCAR_ON_PMSUPDATE': (int, 'Boxcar', 0),
'BOXCAR_ON_CONCURRENT': (int, 'Boxcar', 0),
'BROWSER_ENABLED': (int, 'Boxcar', 0), 'BROWSER_ENABLED': (int, 'Boxcar', 0),
'BROWSER_AUTO_HIDE_DELAY': (int, 'Boxcar', 5), 'BROWSER_AUTO_HIDE_DELAY': (int, 'Boxcar', 5),
'BROWSER_ON_PLAY': (int, 'BROWSER', 0), 'BROWSER_ON_PLAY': (int, 'BROWSER', 0),
@ -94,6 +95,7 @@ _CONFIG_DEFINITIONS = {
'BROWSER_ON_EXTUP': (int, 'BROWSER', 0), 'BROWSER_ON_EXTUP': (int, 'BROWSER', 0),
'BROWSER_ON_INTUP': (int, 'BROWSER', 0), 'BROWSER_ON_INTUP': (int, 'BROWSER', 0),
'BROWSER_ON_PMSUPDATE': (int, 'BROWSER', 0), 'BROWSER_ON_PMSUPDATE': (int, 'BROWSER', 0),
'BROWSER_ON_CONCURRENT': (int, 'BROWSER', 0),
'BUFFER_THRESHOLD': (int, 'Monitoring', 3), 'BUFFER_THRESHOLD': (int, 'Monitoring', 3),
'BUFFER_WAIT': (int, 'Monitoring', 900), 'BUFFER_WAIT': (int, 'Monitoring', 900),
'BACKUP_DIR': (str, 'General', ''), 'BACKUP_DIR': (str, 'General', ''),
@ -130,6 +132,7 @@ _CONFIG_DEFINITIONS = {
'EMAIL_ON_EXTUP': (int, 'Email', 0), 'EMAIL_ON_EXTUP': (int, 'Email', 0),
'EMAIL_ON_INTUP': (int, 'Email', 0), 'EMAIL_ON_INTUP': (int, 'Email', 0),
'EMAIL_ON_PMSUPDATE': (int, 'Email', 0), 'EMAIL_ON_PMSUPDATE': (int, 'Email', 0),
'EMAIL_ON_CONCURRENT': (int, 'Email', 0),
'ENABLE_HTTPS': (int, 'General', 0), 'ENABLE_HTTPS': (int, 'General', 0),
'FACEBOOK_ENABLED': (int, 'Facebook', 0), 'FACEBOOK_ENABLED': (int, 'Facebook', 0),
'FACEBOOK_REDIRECT_URI': (str, 'Facebook', ''), 'FACEBOOK_REDIRECT_URI': (str, 'Facebook', ''),
@ -152,6 +155,7 @@ _CONFIG_DEFINITIONS = {
'FACEBOOK_ON_EXTUP': (int, 'Facebook', 0), 'FACEBOOK_ON_EXTUP': (int, 'Facebook', 0),
'FACEBOOK_ON_INTUP': (int, 'Facebook', 0), 'FACEBOOK_ON_INTUP': (int, 'Facebook', 0),
'FACEBOOK_ON_PMSUPDATE': (int, 'Facebook', 0), 'FACEBOOK_ON_PMSUPDATE': (int, 'Facebook', 0),
'FACEBOOK_ON_CONCURRENT': (int, 'Facebook', 0),
'FIRST_RUN_COMPLETE': (int, 'General', 0), 'FIRST_RUN_COMPLETE': (int, 'General', 0),
'FREEZE_DB': (int, 'General', 0), 'FREEZE_DB': (int, 'General', 0),
'GEOIP_DB': (str, 'General', ''), 'GEOIP_DB': (str, 'General', ''),
@ -180,6 +184,7 @@ _CONFIG_DEFINITIONS = {
'GROWL_ON_EXTUP': (int, 'Growl', 0), 'GROWL_ON_EXTUP': (int, 'Growl', 0),
'GROWL_ON_INTUP': (int, 'Growl', 0), 'GROWL_ON_INTUP': (int, 'Growl', 0),
'GROWL_ON_PMSUPDATE': (int, 'Growl', 0), 'GROWL_ON_PMSUPDATE': (int, 'Growl', 0),
'GROWL_ON_CONCURRENT': (int, 'Growl', 0),
'HOME_SECTIONS': (list, 'General', ['current_activity','watch_stats','library_stats','recently_added']), 'HOME_SECTIONS': (list, 'General', ['current_activity','watch_stats','library_stats','recently_added']),
'HOME_LIBRARY_CARDS': (list, 'General', ['first_run']), 'HOME_LIBRARY_CARDS': (list, 'General', ['first_run']),
'HOME_STATS_LENGTH': (int, 'General', 30), 'HOME_STATS_LENGTH': (int, 'General', 30),
@ -219,6 +224,7 @@ _CONFIG_DEFINITIONS = {
'IFTTT_ON_EXTUP': (int, 'IFTTT', 0), 'IFTTT_ON_EXTUP': (int, 'IFTTT', 0),
'IFTTT_ON_INTUP': (int, 'IFTTT', 0), 'IFTTT_ON_INTUP': (int, 'IFTTT', 0),
'IFTTT_ON_PMSUPDATE': (int, 'IFTTT', 0), 'IFTTT_ON_PMSUPDATE': (int, 'IFTTT', 0),
'IFTTT_ON_CONCURRENT': (int, 'IFTTT', 0),
'IMGUR_CLIENT_ID': (str, 'Monitoring', ''), 'IMGUR_CLIENT_ID': (str, 'Monitoring', ''),
'JOIN_APIKEY': (str, 'Join', ''), 'JOIN_APIKEY': (str, 'Join', ''),
'JOIN_DEVICEID': (str, 'Join', ''), 'JOIN_DEVICEID': (str, 'Join', ''),
@ -236,6 +242,7 @@ _CONFIG_DEFINITIONS = {
'JOIN_ON_EXTUP': (int, 'Join', 0), 'JOIN_ON_EXTUP': (int, 'Join', 0),
'JOIN_ON_INTUP': (int, 'Join', 0), 'JOIN_ON_INTUP': (int, 'Join', 0),
'JOIN_ON_PMSUPDATE': (int, 'Join', 0), 'JOIN_ON_PMSUPDATE': (int, 'Join', 0),
'JOIN_ON_CONCURRENT': (int, 'Join', 0),
'JOURNAL_MODE': (str, 'Advanced', 'wal'), 'JOURNAL_MODE': (str, 'Advanced', 'wal'),
'LAUNCH_BROWSER': (int, 'General', 1), 'LAUNCH_BROWSER': (int, 'General', 1),
'LOG_BLACKLIST': (int, 'General', 1), 'LOG_BLACKLIST': (int, 'General', 1),
@ -270,11 +277,14 @@ _CONFIG_DEFINITIONS = {
'NMA_ON_EXTUP': (int, 'NMA', 0), 'NMA_ON_EXTUP': (int, 'NMA', 0),
'NMA_ON_INTUP': (int, 'NMA', 0), 'NMA_ON_INTUP': (int, 'NMA', 0),
'NMA_ON_PMSUPDATE': (int, 'NMA', 0), 'NMA_ON_PMSUPDATE': (int, 'NMA', 0),
'NMA_ON_CONCURRENT': (int, 'NMA', 0),
'NOTIFY_CONSECUTIVE': (int, 'Monitoring', 1), 'NOTIFY_CONSECUTIVE': (int, 'Monitoring', 1),
'NOTIFY_UPLOAD_POSTERS': (int, 'Monitoring', 0), 'NOTIFY_UPLOAD_POSTERS': (int, 'Monitoring', 0),
'NOTIFY_RECENTLY_ADDED': (int, 'Monitoring', 0), 'NOTIFY_RECENTLY_ADDED': (int, 'Monitoring', 0),
'NOTIFY_RECENTLY_ADDED_GRANDPARENT': (int, 'Monitoring', 0), 'NOTIFY_RECENTLY_ADDED_GRANDPARENT': (int, 'Monitoring', 0),
'NOTIFY_RECENTLY_ADDED_DELAY': (int, 'Monitoring', 60), 'NOTIFY_RECENTLY_ADDED_DELAY': (int, 'Monitoring', 60),
'NOTIFY_CONCURRENT_BY_IP': (int, 'Monitoring', 0),
'NOTIFY_CONCURRENT_THRESHOLD': (int, 'Monitoring', 2),
'NOTIFY_WATCHED_PERCENT': (int, 'Monitoring', 85), 'NOTIFY_WATCHED_PERCENT': (int, 'Monitoring', 85),
'NOTIFY_ON_START_SUBJECT_TEXT': (unicode, 'Monitoring', 'PlexPy ({server_name})'), 'NOTIFY_ON_START_SUBJECT_TEXT': (unicode, 'Monitoring', 'PlexPy ({server_name})'),
'NOTIFY_ON_START_BODY_TEXT': (unicode, 'Monitoring', '{user} ({player}) started playing {title}.'), 'NOTIFY_ON_START_BODY_TEXT': (unicode, 'Monitoring', '{user} ({player}) started playing {title}.'),
@ -300,6 +310,8 @@ _CONFIG_DEFINITIONS = {
'NOTIFY_ON_INTUP_BODY_TEXT': (unicode, 'Monitoring', 'The Plex Media Server is back up.'), 'NOTIFY_ON_INTUP_BODY_TEXT': (unicode, 'Monitoring', 'The Plex Media Server is back up.'),
'NOTIFY_ON_PMSUPDATE_SUBJECT_TEXT': (unicode, 'Monitoring', 'PlexPy ({server_name})'), 'NOTIFY_ON_PMSUPDATE_SUBJECT_TEXT': (unicode, 'Monitoring', 'PlexPy ({server_name})'),
'NOTIFY_ON_PMSUPDATE_BODY_TEXT': (unicode, 'Monitoring', 'An update is available for the Plex Media Server (version {update_version}).'), 'NOTIFY_ON_PMSUPDATE_BODY_TEXT': (unicode, 'Monitoring', 'An update is available for the Plex Media Server (version {update_version}).'),
'NOTIFY_ON_CONCURRENT_SUBJECT_TEXT': (unicode, 'Monitoring', 'PlexPy ({server_name})'),
'NOTIFY_ON_CONCURRENT_BODY_TEXT': (unicode, 'Monitoring', '{user} has {user_streams} concurrent streams.'),
'NOTIFY_SCRIPTS_ARGS_TEXT': (unicode, 'Monitoring', ''), 'NOTIFY_SCRIPTS_ARGS_TEXT': (unicode, 'Monitoring', ''),
'OSX_NOTIFY_APP': (str, 'OSX_Notify', '/Applications/PlexPy'), 'OSX_NOTIFY_APP': (str, 'OSX_Notify', '/Applications/PlexPy'),
'OSX_NOTIFY_ENABLED': (int, 'OSX_Notify', 0), 'OSX_NOTIFY_ENABLED': (int, 'OSX_Notify', 0),
@ -315,6 +327,7 @@ _CONFIG_DEFINITIONS = {
'OSX_NOTIFY_ON_EXTUP': (int, 'OSX_Notify', 0), 'OSX_NOTIFY_ON_EXTUP': (int, 'OSX_Notify', 0),
'OSX_NOTIFY_ON_INTUP': (int, 'OSX_Notify', 0), 'OSX_NOTIFY_ON_INTUP': (int, 'OSX_Notify', 0),
'OSX_NOTIFY_ON_PMSUPDATE': (int, 'OSX_Notify', 0), 'OSX_NOTIFY_ON_PMSUPDATE': (int, 'OSX_Notify', 0),
'OSX_NOTIFY_ON_CONCURRENT': (int, 'OSX_Notify', 0),
'PLEX_CLIENT_HOST': (str, 'Plex', ''), 'PLEX_CLIENT_HOST': (str, 'Plex', ''),
'PLEX_ENABLED': (int, 'Plex', 0), 'PLEX_ENABLED': (int, 'Plex', 0),
'PLEX_PASSWORD': (str, 'Plex', ''), 'PLEX_PASSWORD': (str, 'Plex', ''),
@ -331,6 +344,7 @@ _CONFIG_DEFINITIONS = {
'PLEX_ON_EXTUP': (int, 'Plex', 0), 'PLEX_ON_EXTUP': (int, 'Plex', 0),
'PLEX_ON_INTUP': (int, 'Plex', 0), 'PLEX_ON_INTUP': (int, 'Plex', 0),
'PLEX_ON_PMSUPDATE': (int, 'Plex', 0), 'PLEX_ON_PMSUPDATE': (int, 'Plex', 0),
'PLEX_ON_CONCURRENT': (int, 'Plex', 0),
'PROWL_ENABLED': (int, 'Prowl', 0), 'PROWL_ENABLED': (int, 'Prowl', 0),
'PROWL_KEYS': (str, 'Prowl', ''), 'PROWL_KEYS': (str, 'Prowl', ''),
'PROWL_PRIORITY': (int, 'Prowl', 0), 'PROWL_PRIORITY': (int, 'Prowl', 0),
@ -346,6 +360,7 @@ _CONFIG_DEFINITIONS = {
'PROWL_ON_EXTUP': (int, 'Prowl', 0), 'PROWL_ON_EXTUP': (int, 'Prowl', 0),
'PROWL_ON_INTUP': (int, 'Prowl', 0), 'PROWL_ON_INTUP': (int, 'Prowl', 0),
'PROWL_ON_PMSUPDATE': (int, 'Prowl', 0), 'PROWL_ON_PMSUPDATE': (int, 'Prowl', 0),
'PROWL_ON_CONCURRENT': (int, 'Prowl', 0),
'PUSHALOT_APIKEY': (str, 'Pushalot', ''), 'PUSHALOT_APIKEY': (str, 'Pushalot', ''),
'PUSHALOT_ENABLED': (int, 'Pushalot', 0), 'PUSHALOT_ENABLED': (int, 'Pushalot', 0),
'PUSHALOT_ON_PLAY': (int, 'Pushalot', 0), 'PUSHALOT_ON_PLAY': (int, 'Pushalot', 0),
@ -360,6 +375,7 @@ _CONFIG_DEFINITIONS = {
'PUSHALOT_ON_EXTUP': (int, 'Pushalot', 0), 'PUSHALOT_ON_EXTUP': (int, 'Pushalot', 0),
'PUSHALOT_ON_INTUP': (int, 'Pushalot', 0), 'PUSHALOT_ON_INTUP': (int, 'Pushalot', 0),
'PUSHALOT_ON_PMSUPDATE': (int, 'Pushalot', 0), 'PUSHALOT_ON_PMSUPDATE': (int, 'Pushalot', 0),
'PUSHALOT_ON_CONCURRENT': (int, 'Pushalot', 0),
'PUSHBULLET_APIKEY': (str, 'PushBullet', ''), 'PUSHBULLET_APIKEY': (str, 'PushBullet', ''),
'PUSHBULLET_DEVICEID': (str, 'PushBullet', ''), 'PUSHBULLET_DEVICEID': (str, 'PushBullet', ''),
'PUSHBULLET_CHANNEL_TAG': (str, 'PushBullet', ''), 'PUSHBULLET_CHANNEL_TAG': (str, 'PushBullet', ''),
@ -376,6 +392,7 @@ _CONFIG_DEFINITIONS = {
'PUSHBULLET_ON_EXTUP': (int, 'PushBullet', 0), 'PUSHBULLET_ON_EXTUP': (int, 'PushBullet', 0),
'PUSHBULLET_ON_INTUP': (int, 'PushBullet', 0), 'PUSHBULLET_ON_INTUP': (int, 'PushBullet', 0),
'PUSHBULLET_ON_PMSUPDATE': (int, 'PushBullet', 0), 'PUSHBULLET_ON_PMSUPDATE': (int, 'PushBullet', 0),
'PUSHBULLET_ON_CONCURRENT': (int, 'PushBullet', 0),
'PUSHOVER_APITOKEN': (str, 'Pushover', ''), 'PUSHOVER_APITOKEN': (str, 'Pushover', ''),
'PUSHOVER_ENABLED': (int, 'Pushover', 0), 'PUSHOVER_ENABLED': (int, 'Pushover', 0),
'PUSHOVER_HTML_SUPPORT': (int, 'Pushover', 1), 'PUSHOVER_HTML_SUPPORT': (int, 'Pushover', 1),
@ -394,6 +411,7 @@ _CONFIG_DEFINITIONS = {
'PUSHOVER_ON_EXTUP': (int, 'Pushover', 0), 'PUSHOVER_ON_EXTUP': (int, 'Pushover', 0),
'PUSHOVER_ON_INTUP': (int, 'Pushover', 0), 'PUSHOVER_ON_INTUP': (int, 'Pushover', 0),
'PUSHOVER_ON_PMSUPDATE': (int, 'Pushover', 0), 'PUSHOVER_ON_PMSUPDATE': (int, 'Pushover', 0),
'PUSHOVER_ON_CONCURRENT': (int, 'Pushover', 0),
'REFRESH_LIBRARIES_INTERVAL': (int, 'Monitoring', 12), 'REFRESH_LIBRARIES_INTERVAL': (int, 'Monitoring', 12),
'REFRESH_LIBRARIES_ON_STARTUP': (int, 'Monitoring', 1), 'REFRESH_LIBRARIES_ON_STARTUP': (int, 'Monitoring', 1),
'REFRESH_USERS_INTERVAL': (int, 'Monitoring', 12), 'REFRESH_USERS_INTERVAL': (int, 'Monitoring', 12),
@ -419,6 +437,7 @@ _CONFIG_DEFINITIONS = {
'SLACK_ON_EXTUP': (int, 'Slack', 0), 'SLACK_ON_EXTUP': (int, 'Slack', 0),
'SLACK_ON_INTUP': (int, 'Slack', 0), 'SLACK_ON_INTUP': (int, 'Slack', 0),
'SLACK_ON_PMSUPDATE': (int, 'Slack', 0), 'SLACK_ON_PMSUPDATE': (int, 'Slack', 0),
'SLACK_ON_CONCURRENT': (int, 'Slack', 0),
'SCRIPTS_ENABLED': (int, 'Scripts', 0), 'SCRIPTS_ENABLED': (int, 'Scripts', 0),
'SCRIPTS_FOLDER': (unicode, 'Scripts', ''), 'SCRIPTS_FOLDER': (unicode, 'Scripts', ''),
'SCRIPTS_ON_PLAY': (int, 'Scripts', 0), 'SCRIPTS_ON_PLAY': (int, 'Scripts', 0),
@ -433,6 +452,7 @@ _CONFIG_DEFINITIONS = {
'SCRIPTS_ON_INTDOWN': (int, 'Scripts', 0), 'SCRIPTS_ON_INTDOWN': (int, 'Scripts', 0),
'SCRIPTS_ON_INTUP': (int, 'Scripts', 0), 'SCRIPTS_ON_INTUP': (int, 'Scripts', 0),
'SCRIPTS_ON_PMSUPDATE': (int, 'Scripts', 0), 'SCRIPTS_ON_PMSUPDATE': (int, 'Scripts', 0),
'SCRIPTS_ON_CONCURRENT': (int, 'Scripts', 0),
'SCRIPTS_ON_PLAY_SCRIPT': (unicode, 'Scripts', ''), 'SCRIPTS_ON_PLAY_SCRIPT': (unicode, 'Scripts', ''),
'SCRIPTS_ON_STOP_SCRIPT': (unicode, 'Scripts', ''), 'SCRIPTS_ON_STOP_SCRIPT': (unicode, 'Scripts', ''),
'SCRIPTS_ON_PAUSE_SCRIPT': (unicode, 'Scripts', ''), 'SCRIPTS_ON_PAUSE_SCRIPT': (unicode, 'Scripts', ''),
@ -445,6 +465,7 @@ _CONFIG_DEFINITIONS = {
'SCRIPTS_ON_INTDOWN_SCRIPT': (unicode, 'Scripts', ''), 'SCRIPTS_ON_INTDOWN_SCRIPT': (unicode, 'Scripts', ''),
'SCRIPTS_ON_INTUP_SCRIPT': (unicode, 'Scripts', ''), 'SCRIPTS_ON_INTUP_SCRIPT': (unicode, 'Scripts', ''),
'SCRIPTS_ON_PMSUPDATE_SCRIPT': (unicode, 'Scripts', ''), 'SCRIPTS_ON_PMSUPDATE_SCRIPT': (unicode, 'Scripts', ''),
'SCRIPTS_ON_CONCURRENT_SCRIPT': (unicode, 'Scripts', ''),
'TELEGRAM_BOT_TOKEN': (str, 'Telegram', ''), 'TELEGRAM_BOT_TOKEN': (str, 'Telegram', ''),
'TELEGRAM_ENABLED': (int, 'Telegram', 0), 'TELEGRAM_ENABLED': (int, 'Telegram', 0),
'TELEGRAM_CHAT_ID': (str, 'Telegram', ''), 'TELEGRAM_CHAT_ID': (str, 'Telegram', ''),
@ -463,6 +484,7 @@ _CONFIG_DEFINITIONS = {
'TELEGRAM_ON_EXTUP': (int, 'Telegram', 0), 'TELEGRAM_ON_EXTUP': (int, 'Telegram', 0),
'TELEGRAM_ON_INTUP': (int, 'Telegram', 0), 'TELEGRAM_ON_INTUP': (int, 'Telegram', 0),
'TELEGRAM_ON_PMSUPDATE': (int, 'Telegram', 0), 'TELEGRAM_ON_PMSUPDATE': (int, 'Telegram', 0),
'TELEGRAM_ON_CONCURRENT': (int, 'Telegram', 0),
'TV_LOGGING_ENABLE': (int, 'Monitoring', 1), 'TV_LOGGING_ENABLE': (int, 'Monitoring', 1),
'TV_NOTIFY_ENABLE': (int, 'Monitoring', 0), 'TV_NOTIFY_ENABLE': (int, 'Monitoring', 0),
'TV_NOTIFY_ON_START': (int, 'Monitoring', 1), 'TV_NOTIFY_ON_START': (int, 'Monitoring', 1),
@ -487,6 +509,7 @@ _CONFIG_DEFINITIONS = {
'TWITTER_ON_EXTUP': (int, 'Twitter', 0), 'TWITTER_ON_EXTUP': (int, 'Twitter', 0),
'TWITTER_ON_INTUP': (int, 'Twitter', 0), 'TWITTER_ON_INTUP': (int, 'Twitter', 0),
'TWITTER_ON_PMSUPDATE': (int, 'Twitter', 0), 'TWITTER_ON_PMSUPDATE': (int, 'Twitter', 0),
'TWITTER_ON_CONCURRENT': (int, 'Twitter', 0),
'UPDATE_DB_INTERVAL': (int, 'General', 24), 'UPDATE_DB_INTERVAL': (int, 'General', 24),
'UPDATE_SECTION_IDS': (int, 'General', 1), 'UPDATE_SECTION_IDS': (int, 'General', 1),
'UPDATE_LABELS': (int, 'General', 1), 'UPDATE_LABELS': (int, 'General', 1),
@ -507,7 +530,8 @@ _CONFIG_DEFINITIONS = {
'XBMC_ON_INTDOWN': (int, 'XBMC', 0), 'XBMC_ON_INTDOWN': (int, 'XBMC', 0),
'XBMC_ON_EXTUP': (int, 'XBMC', 0), 'XBMC_ON_EXTUP': (int, 'XBMC', 0),
'XBMC_ON_INTUP': (int, 'XBMC', 0), 'XBMC_ON_INTUP': (int, 'XBMC', 0),
'XBMC_ON_PMSUPDATE': (int, 'XBMC', 0) 'XBMC_ON_PMSUPDATE': (int, 'XBMC', 0),
'XBMC_ON_CONCURRENT': (int, 'XBMC', 0)
} }
_BLACKLIST_KEYS = ['_APITOKEN', '_TOKEN', '_KEY', '_SECRET', '_PASSWORD', '_APIKEY', '_ID'] _BLACKLIST_KEYS = ['_APITOKEN', '_TOKEN', '_KEY', '_SECRET', '_PASSWORD', '_APIKEY', '_ID']

View file

@ -182,6 +182,26 @@ def notify(stream_data=None, notify_action=None):
notify_strings=notify_strings, notify_strings=notify_strings,
metadata=metadata) metadata=metadata)
elif agent['on_concurrent'] and notify_action == 'concurrent':
# Build and send notification
notify_strings, metadata = build_notify_text(session=stream_data,
notify_action=notify_action,
agent_id=agent['id'])
notifiers.send_notification(agent_id=agent['id'],
subject=notify_strings[0],
body=notify_strings[1],
script_args=notify_strings[2],
notify_action=notify_action,
metadata=metadata)
# Set the notification state in the db
set_notify_state(session=stream_data,
notify_action=notify_action,
agent_info=agent,
notify_strings=notify_strings,
metadata=metadata)
elif (stream_data['media_type'] == 'track' and plexpy.CONFIG.MUSIC_NOTIFY_ENABLE): elif (stream_data['media_type'] == 'track' and plexpy.CONFIG.MUSIC_NOTIFY_ENABLE):
for agent in notifiers.available_notification_agents(): for agent in notifiers.available_notification_agents():
@ -485,7 +505,10 @@ def build_notify_text(session=None, timeline=None, notify_action=None, agent_id=
pms_connect = pmsconnect.PmsConnect() pms_connect = pmsconnect.PmsConnect()
metadata_list = pms_connect.get_metadata_details(rating_key=rating_key) metadata_list = pms_connect.get_metadata_details(rating_key=rating_key)
stream_count = pms_connect.get_current_activity().get('stream_count', '') current_activity = pms_connect.get_current_activity()
sessions = current_activity.get('sessions', [])
stream_count = current_activity.get('stream_count', '')
user_stream_count = sum(1 for d in sessions if d['user_id'] == session['user_id'])
if metadata_list: if metadata_list:
metadata = metadata_list['metadata'] metadata = metadata_list['metadata']
@ -525,6 +548,8 @@ def build_notify_text(session=None, timeline=None, notify_action=None, agent_id=
on_watched_body = strip_tag(re.sub(pattern, '', plexpy.CONFIG.NOTIFY_ON_WATCHED_BODY_TEXT), agent_id) on_watched_body = strip_tag(re.sub(pattern, '', plexpy.CONFIG.NOTIFY_ON_WATCHED_BODY_TEXT), agent_id)
on_created_subject = strip_tag(re.sub(pattern, '', plexpy.CONFIG.NOTIFY_ON_CREATED_SUBJECT_TEXT), agent_id) on_created_subject = strip_tag(re.sub(pattern, '', plexpy.CONFIG.NOTIFY_ON_CREATED_SUBJECT_TEXT), agent_id)
on_created_body = strip_tag(re.sub(pattern, '', plexpy.CONFIG.NOTIFY_ON_CREATED_BODY_TEXT), agent_id) on_created_body = strip_tag(re.sub(pattern, '', plexpy.CONFIG.NOTIFY_ON_CREATED_BODY_TEXT), agent_id)
on_concurrent_subject = strip_tag(re.sub(pattern, '', plexpy.CONFIG.NOTIFY_ON_CONCURRENT_SUBJECT_TEXT), agent_id)
on_concurrent_body = strip_tag(re.sub(pattern, '', plexpy.CONFIG.NOTIFY_ON_CONCURRENT_BODY_TEXT), agent_id)
script_args_text = strip_tag(re.sub(pattern, '', plexpy.CONFIG.NOTIFY_SCRIPTS_ARGS_TEXT), agent_id) script_args_text = strip_tag(re.sub(pattern, '', plexpy.CONFIG.NOTIFY_SCRIPTS_ARGS_TEXT), agent_id)
else: else:
on_start_subject = strip_tag(plexpy.CONFIG.NOTIFY_ON_START_SUBJECT_TEXT, agent_id) on_start_subject = strip_tag(plexpy.CONFIG.NOTIFY_ON_START_SUBJECT_TEXT, agent_id)
@ -541,6 +566,8 @@ def build_notify_text(session=None, timeline=None, notify_action=None, agent_id=
on_watched_body = strip_tag(plexpy.CONFIG.NOTIFY_ON_WATCHED_BODY_TEXT, agent_id) on_watched_body = strip_tag(plexpy.CONFIG.NOTIFY_ON_WATCHED_BODY_TEXT, agent_id)
on_created_subject = strip_tag(plexpy.CONFIG.NOTIFY_ON_CREATED_SUBJECT_TEXT, agent_id) on_created_subject = strip_tag(plexpy.CONFIG.NOTIFY_ON_CREATED_SUBJECT_TEXT, agent_id)
on_created_body = strip_tag(plexpy.CONFIG.NOTIFY_ON_CREATED_BODY_TEXT, agent_id) on_created_body = strip_tag(plexpy.CONFIG.NOTIFY_ON_CREATED_BODY_TEXT, agent_id)
on_concurrent_subject = strip_tag(plexpy.CONFIG.NOTIFY_ON_CONCURRENT_SUBJECT_TEXT, agent_id)
on_concurrent_body = strip_tag(plexpy.CONFIG.NOTIFY_ON_CONCURRENT_BODY_TEXT, agent_id)
script_args_text = strip_tag(plexpy.CONFIG.NOTIFY_SCRIPTS_ARGS_TEXT, agent_id) script_args_text = strip_tag(plexpy.CONFIG.NOTIFY_SCRIPTS_ARGS_TEXT, agent_id)
# Create a title # Create a title
@ -676,6 +703,7 @@ def build_notify_text(session=None, timeline=None, notify_action=None, agent_id=
'timestamp': arrow.now().format(time_format), 'timestamp': arrow.now().format(time_format),
# Stream parameters # Stream parameters
'streams': stream_count, 'streams': stream_count,
'user_streams': user_stream_count,
'user': session.get('friendly_name',''), 'user': session.get('friendly_name',''),
'username': session.get('user',''), 'username': session.get('user',''),
'platform': session.get('platform',''), 'platform': session.get('platform',''),
@ -940,6 +968,29 @@ def build_notify_text(session=None, timeline=None, notify_action=None, agent_id=
except: except:
logger.error(u"PlexPy NotificationHandler :: Unable to parse custom notification body. Using fallback.") logger.error(u"PlexPy NotificationHandler :: Unable to parse custom notification body. Using fallback.")
return [subject_text, body_text, script_args], metadata
else:
return [subject_text, body_text, script_args], metadata
elif notify_action == 'concurrent':
# Default body text
body_text = '%s has %s concurrent streams.' % (session['friendly_name'],
user_stream_count)
if on_concurrent_subject and on_concurrent_body:
try:
subject_text = unicode(on_concurrent_subject).format(**available_params)
except LookupError as e:
logger.error(u"PlexPy NotificationHandler :: Unable to parse field %s in notification subject. Using fallback." % e)
except:
logger.error(u"PlexPy NotificationHandler :: Unable to parse custom notification subject. Using fallback.")
try:
body_text = unicode(on_concurrent_body).format(**available_params)
except LookupError as e:
logger.error(u"PlexPy NotificationHandler :: Unable to parse field %s in notification body. Using fallback." % e)
except:
logger.error(u"PlexPy NotificationHandler :: Unable to parse custom notification body. Using fallback.")
return [subject_text, body_text, script_args], metadata return [subject_text, body_text, script_args], metadata
else: else:
return [subject_text, body_text, script_args], metadata return [subject_text, body_text, script_args], metadata

View file

@ -82,7 +82,8 @@ def available_notification_agents():
'on_intdown': plexpy.CONFIG.GROWL_ON_INTDOWN, 'on_intdown': plexpy.CONFIG.GROWL_ON_INTDOWN,
'on_extup': plexpy.CONFIG.GROWL_ON_EXTUP, 'on_extup': plexpy.CONFIG.GROWL_ON_EXTUP,
'on_intup': plexpy.CONFIG.GROWL_ON_INTUP, 'on_intup': plexpy.CONFIG.GROWL_ON_INTUP,
'on_pmsupdate': plexpy.CONFIG.GROWL_ON_PMSUPDATE 'on_pmsupdate': plexpy.CONFIG.GROWL_ON_PMSUPDATE,
'on_concurrent': plexpy.CONFIG.GROWL_ON_CONCURRENT
}, },
{'name': 'Prowl', {'name': 'Prowl',
'id': AGENT_IDS['Prowl'], 'id': AGENT_IDS['Prowl'],
@ -100,7 +101,8 @@ def available_notification_agents():
'on_intdown': plexpy.CONFIG.PROWL_ON_INTDOWN, 'on_intdown': plexpy.CONFIG.PROWL_ON_INTDOWN,
'on_extup': plexpy.CONFIG.PROWL_ON_EXTUP, 'on_extup': plexpy.CONFIG.PROWL_ON_EXTUP,
'on_intup': plexpy.CONFIG.PROWL_ON_INTUP, 'on_intup': plexpy.CONFIG.PROWL_ON_INTUP,
'on_pmsupdate': plexpy.CONFIG.PROWL_ON_PMSUPDATE 'on_pmsupdate': plexpy.CONFIG.PROWL_ON_PMSUPDATE,
'on_concurrent': plexpy.CONFIG.PROWL_ON_CONCURRENT
}, },
{'name': 'XBMC', {'name': 'XBMC',
'id': AGENT_IDS['XBMC'], 'id': AGENT_IDS['XBMC'],
@ -118,7 +120,8 @@ def available_notification_agents():
'on_intdown': plexpy.CONFIG.XBMC_ON_INTDOWN, 'on_intdown': plexpy.CONFIG.XBMC_ON_INTDOWN,
'on_extup': plexpy.CONFIG.XBMC_ON_EXTUP, 'on_extup': plexpy.CONFIG.XBMC_ON_EXTUP,
'on_intup': plexpy.CONFIG.XBMC_ON_INTUP, 'on_intup': plexpy.CONFIG.XBMC_ON_INTUP,
'on_pmsupdate': plexpy.CONFIG.XBMC_ON_PMSUPDATE 'on_pmsupdate': plexpy.CONFIG.XBMC_ON_PMSUPDATE,
'on_concurrent': plexpy.CONFIG.XBMC_ON_CONCURRENT
}, },
{'name': 'Plex Home Theater', {'name': 'Plex Home Theater',
'id': AGENT_IDS['Plex'], 'id': AGENT_IDS['Plex'],
@ -136,7 +139,8 @@ def available_notification_agents():
'on_intdown': plexpy.CONFIG.PLEX_ON_INTDOWN, 'on_intdown': plexpy.CONFIG.PLEX_ON_INTDOWN,
'on_extup': plexpy.CONFIG.PLEX_ON_EXTUP, 'on_extup': plexpy.CONFIG.PLEX_ON_EXTUP,
'on_intup': plexpy.CONFIG.PLEX_ON_INTUP, 'on_intup': plexpy.CONFIG.PLEX_ON_INTUP,
'on_pmsupdate': plexpy.CONFIG.PLEX_ON_PMSUPDATE 'on_pmsupdate': plexpy.CONFIG.PLEX_ON_PMSUPDATE,
'on_concurrent': plexpy.CONFIG.PLEX_ON_CONCURRENT
}, },
{'name': 'NotifyMyAndroid', {'name': 'NotifyMyAndroid',
'id': AGENT_IDS['NMA'], 'id': AGENT_IDS['NMA'],
@ -154,7 +158,8 @@ def available_notification_agents():
'on_intdown': plexpy.CONFIG.NMA_ON_INTDOWN, 'on_intdown': plexpy.CONFIG.NMA_ON_INTDOWN,
'on_extup': plexpy.CONFIG.NMA_ON_EXTUP, 'on_extup': plexpy.CONFIG.NMA_ON_EXTUP,
'on_intup': plexpy.CONFIG.NMA_ON_INTUP, 'on_intup': plexpy.CONFIG.NMA_ON_INTUP,
'on_pmsupdate': plexpy.CONFIG.NMA_ON_PMSUPDATE 'on_pmsupdate': plexpy.CONFIG.NMA_ON_PMSUPDATE,
'on_concurrent': plexpy.CONFIG.NMA_ON_CONCURRENT
}, },
{'name': 'Pushalot', {'name': 'Pushalot',
'id': AGENT_IDS['Pushalot'], 'id': AGENT_IDS['Pushalot'],
@ -172,7 +177,8 @@ def available_notification_agents():
'on_intdown': plexpy.CONFIG.PUSHALOT_ON_INTDOWN, 'on_intdown': plexpy.CONFIG.PUSHALOT_ON_INTDOWN,
'on_extup': plexpy.CONFIG.PUSHALOT_ON_EXTUP, 'on_extup': plexpy.CONFIG.PUSHALOT_ON_EXTUP,
'on_intup': plexpy.CONFIG.PUSHALOT_ON_INTUP, 'on_intup': plexpy.CONFIG.PUSHALOT_ON_INTUP,
'on_pmsupdate': plexpy.CONFIG.PUSHALOT_ON_PMSUPDATE 'on_pmsupdate': plexpy.CONFIG.PUSHALOT_ON_PMSUPDATE,
'on_concurrent': plexpy.CONFIG.PUSHALOT_ON_CONCURRENT
}, },
{'name': 'Pushbullet', {'name': 'Pushbullet',
'id': AGENT_IDS['Pushbullet'], 'id': AGENT_IDS['Pushbullet'],
@ -190,7 +196,8 @@ def available_notification_agents():
'on_intdown': plexpy.CONFIG.PUSHBULLET_ON_INTDOWN, 'on_intdown': plexpy.CONFIG.PUSHBULLET_ON_INTDOWN,
'on_extup': plexpy.CONFIG.PUSHBULLET_ON_EXTUP, 'on_extup': plexpy.CONFIG.PUSHBULLET_ON_EXTUP,
'on_intup': plexpy.CONFIG.PUSHBULLET_ON_INTUP, 'on_intup': plexpy.CONFIG.PUSHBULLET_ON_INTUP,
'on_pmsupdate': plexpy.CONFIG.PUSHBULLET_ON_PMSUPDATE 'on_pmsupdate': plexpy.CONFIG.PUSHBULLET_ON_PMSUPDATE,
'on_concurrent': plexpy.CONFIG.PUSHBULLET_ON_CONCURRENT
}, },
{'name': 'Pushover', {'name': 'Pushover',
'id': AGENT_IDS['Pushover'], 'id': AGENT_IDS['Pushover'],
@ -208,7 +215,8 @@ def available_notification_agents():
'on_intdown': plexpy.CONFIG.PUSHOVER_ON_INTDOWN, 'on_intdown': plexpy.CONFIG.PUSHOVER_ON_INTDOWN,
'on_extup': plexpy.CONFIG.PUSHOVER_ON_EXTUP, 'on_extup': plexpy.CONFIG.PUSHOVER_ON_EXTUP,
'on_intup': plexpy.CONFIG.PUSHOVER_ON_INTUP, 'on_intup': plexpy.CONFIG.PUSHOVER_ON_INTUP,
'on_pmsupdate': plexpy.CONFIG.PUSHOVER_ON_PMSUPDATE 'on_pmsupdate': plexpy.CONFIG.PUSHOVER_ON_PMSUPDATE,
'on_concurrent': plexpy.CONFIG.PUSHOVER_ON_CONCURRENT
}, },
{'name': 'Boxcar2', {'name': 'Boxcar2',
'id': AGENT_IDS['Boxcar2'], 'id': AGENT_IDS['Boxcar2'],
@ -226,7 +234,8 @@ def available_notification_agents():
'on_intdown': plexpy.CONFIG.BOXCAR_ON_INTDOWN, 'on_intdown': plexpy.CONFIG.BOXCAR_ON_INTDOWN,
'on_extup': plexpy.CONFIG.BOXCAR_ON_EXTUP, 'on_extup': plexpy.CONFIG.BOXCAR_ON_EXTUP,
'on_intup': plexpy.CONFIG.BOXCAR_ON_INTUP, 'on_intup': plexpy.CONFIG.BOXCAR_ON_INTUP,
'on_pmsupdate': plexpy.CONFIG.BOXCAR_ON_PMSUPDATE 'on_pmsupdate': plexpy.CONFIG.BOXCAR_ON_PMSUPDATE,
'on_concurrent': plexpy.CONFIG.BOXCAR_ON_CONCURRENT
}, },
{'name': 'E-mail', {'name': 'E-mail',
'id': AGENT_IDS['Email'], 'id': AGENT_IDS['Email'],
@ -244,7 +253,8 @@ def available_notification_agents():
'on_intdown': plexpy.CONFIG.EMAIL_ON_INTDOWN, 'on_intdown': plexpy.CONFIG.EMAIL_ON_INTDOWN,
'on_extup': plexpy.CONFIG.EMAIL_ON_EXTUP, 'on_extup': plexpy.CONFIG.EMAIL_ON_EXTUP,
'on_intup': plexpy.CONFIG.EMAIL_ON_INTUP, 'on_intup': plexpy.CONFIG.EMAIL_ON_INTUP,
'on_pmsupdate': plexpy.CONFIG.EMAIL_ON_PMSUPDATE 'on_pmsupdate': plexpy.CONFIG.EMAIL_ON_PMSUPDATE,
'on_concurrent': plexpy.CONFIG.EMAIL_ON_CONCURRENT
}, },
{'name': 'Twitter', {'name': 'Twitter',
'id': AGENT_IDS['Twitter'], 'id': AGENT_IDS['Twitter'],
@ -262,7 +272,8 @@ def available_notification_agents():
'on_intdown': plexpy.CONFIG.TWITTER_ON_INTDOWN, 'on_intdown': plexpy.CONFIG.TWITTER_ON_INTDOWN,
'on_extup': plexpy.CONFIG.TWITTER_ON_EXTUP, 'on_extup': plexpy.CONFIG.TWITTER_ON_EXTUP,
'on_intup': plexpy.CONFIG.TWITTER_ON_INTUP, 'on_intup': plexpy.CONFIG.TWITTER_ON_INTUP,
'on_pmsupdate': plexpy.CONFIG.TWITTER_ON_PMSUPDATE 'on_pmsupdate': plexpy.CONFIG.TWITTER_ON_PMSUPDATE,
'on_concurrent': plexpy.CONFIG.TWITTER_ON_CONCURRENT
}, },
{'name': 'IFTTT', {'name': 'IFTTT',
'id': AGENT_IDS['IFTTT'], 'id': AGENT_IDS['IFTTT'],
@ -280,7 +291,8 @@ def available_notification_agents():
'on_intdown': plexpy.CONFIG.IFTTT_ON_INTDOWN, 'on_intdown': plexpy.CONFIG.IFTTT_ON_INTDOWN,
'on_extup': plexpy.CONFIG.IFTTT_ON_EXTUP, 'on_extup': plexpy.CONFIG.IFTTT_ON_EXTUP,
'on_intup': plexpy.CONFIG.IFTTT_ON_INTUP, 'on_intup': plexpy.CONFIG.IFTTT_ON_INTUP,
'on_pmsupdate': plexpy.CONFIG.IFTTT_ON_PMSUPDATE 'on_pmsupdate': plexpy.CONFIG.IFTTT_ON_PMSUPDATE,
'on_concurrent': plexpy.CONFIG.IFTTT_ON_CONCURRENT
}, },
{'name': 'Telegram', {'name': 'Telegram',
'id': AGENT_IDS['Telegram'], 'id': AGENT_IDS['Telegram'],
@ -298,7 +310,8 @@ def available_notification_agents():
'on_intdown': plexpy.CONFIG.TELEGRAM_ON_INTDOWN, 'on_intdown': plexpy.CONFIG.TELEGRAM_ON_INTDOWN,
'on_extup': plexpy.CONFIG.TELEGRAM_ON_EXTUP, 'on_extup': plexpy.CONFIG.TELEGRAM_ON_EXTUP,
'on_intup': plexpy.CONFIG.TELEGRAM_ON_INTUP, 'on_intup': plexpy.CONFIG.TELEGRAM_ON_INTUP,
'on_pmsupdate': plexpy.CONFIG.TELEGRAM_ON_PMSUPDATE 'on_pmsupdate': plexpy.CONFIG.TELEGRAM_ON_PMSUPDATE,
'on_concurrent': plexpy.CONFIG.TELEGRAM_ON_CONCURRENT
}, },
{'name': 'Slack', {'name': 'Slack',
'id': AGENT_IDS['Slack'], 'id': AGENT_IDS['Slack'],
@ -316,7 +329,8 @@ def available_notification_agents():
'on_intdown': plexpy.CONFIG.SLACK_ON_INTDOWN, 'on_intdown': plexpy.CONFIG.SLACK_ON_INTDOWN,
'on_extup': plexpy.CONFIG.SLACK_ON_EXTUP, 'on_extup': plexpy.CONFIG.SLACK_ON_EXTUP,
'on_intup': plexpy.CONFIG.SLACK_ON_INTUP, 'on_intup': plexpy.CONFIG.SLACK_ON_INTUP,
'on_pmsupdate': plexpy.CONFIG.SLACK_ON_PMSUPDATE 'on_pmsupdate': plexpy.CONFIG.SLACK_ON_PMSUPDATE,
'on_concurrent': plexpy.CONFIG.SLACK_ON_CONCURRENT
}, },
{'name': 'Scripts', {'name': 'Scripts',
'id': AGENT_IDS['Scripts'], 'id': AGENT_IDS['Scripts'],
@ -334,7 +348,8 @@ def available_notification_agents():
'on_extup': plexpy.CONFIG.SCRIPTS_ON_EXTUP, 'on_extup': plexpy.CONFIG.SCRIPTS_ON_EXTUP,
'on_intdown': plexpy.CONFIG.SCRIPTS_ON_INTDOWN, 'on_intdown': plexpy.CONFIG.SCRIPTS_ON_INTDOWN,
'on_intup': plexpy.CONFIG.SCRIPTS_ON_INTUP, 'on_intup': plexpy.CONFIG.SCRIPTS_ON_INTUP,
'on_pmsupdate': plexpy.CONFIG.SCRIPTS_ON_PMSUPDATE 'on_pmsupdate': plexpy.CONFIG.SCRIPTS_ON_PMSUPDATE,
'on_concurrent': plexpy.CONFIG.SCRIPTS_ON_CONCURRENT
}, },
{'name': 'Facebook', {'name': 'Facebook',
'id': AGENT_IDS['Facebook'], 'id': AGENT_IDS['Facebook'],
@ -352,7 +367,8 @@ def available_notification_agents():
'on_intdown': plexpy.CONFIG.FACEBOOK_ON_INTDOWN, 'on_intdown': plexpy.CONFIG.FACEBOOK_ON_INTDOWN,
'on_extup': plexpy.CONFIG.FACEBOOK_ON_EXTUP, 'on_extup': plexpy.CONFIG.FACEBOOK_ON_EXTUP,
'on_intup': plexpy.CONFIG.FACEBOOK_ON_INTUP, 'on_intup': plexpy.CONFIG.FACEBOOK_ON_INTUP,
'on_pmsupdate': plexpy.CONFIG.FACEBOOK_ON_PMSUPDATE 'on_pmsupdate': plexpy.CONFIG.FACEBOOK_ON_PMSUPDATE,
'on_concurrent': plexpy.CONFIG.FACEBOOK_ON_CONCURRENT
}, },
{'name': 'Browser', {'name': 'Browser',
'id': AGENT_IDS['Browser'], 'id': AGENT_IDS['Browser'],
@ -370,7 +386,8 @@ def available_notification_agents():
'on_intdown': plexpy.CONFIG.BROWSER_ON_INTDOWN, 'on_intdown': plexpy.CONFIG.BROWSER_ON_INTDOWN,
'on_extup': plexpy.CONFIG.BROWSER_ON_EXTUP, 'on_extup': plexpy.CONFIG.BROWSER_ON_EXTUP,
'on_intup': plexpy.CONFIG.BROWSER_ON_INTUP, 'on_intup': plexpy.CONFIG.BROWSER_ON_INTUP,
'on_pmsupdate': plexpy.CONFIG.BROWSER_ON_PMSUPDATE 'on_pmsupdate': plexpy.CONFIG.BROWSER_ON_PMSUPDATE,
'on_concurrent': plexpy.CONFIG.BROWSER_ON_CONCURRENT
}, },
{'name': 'Join', {'name': 'Join',
'id': AGENT_IDS['Join'], 'id': AGENT_IDS['Join'],
@ -388,7 +405,8 @@ def available_notification_agents():
'on_intdown': plexpy.CONFIG.JOIN_ON_INTDOWN, 'on_intdown': plexpy.CONFIG.JOIN_ON_INTDOWN,
'on_extup': plexpy.CONFIG.JOIN_ON_EXTUP, 'on_extup': plexpy.CONFIG.JOIN_ON_EXTUP,
'on_intup': plexpy.CONFIG.JOIN_ON_INTUP, 'on_intup': plexpy.CONFIG.JOIN_ON_INTUP,
'on_pmsupdate': plexpy.CONFIG.JOIN_ON_PMSUPDATE 'on_pmsupdate': plexpy.CONFIG.JOIN_ON_PMSUPDATE,
'on_concurrent': plexpy.CONFIG.JOIN_ON_CONCURRENT
} }
] ]

View file

@ -2569,6 +2569,8 @@ class WebInterface(object):
"notify_recently_added": checked(plexpy.CONFIG.NOTIFY_RECENTLY_ADDED), "notify_recently_added": checked(plexpy.CONFIG.NOTIFY_RECENTLY_ADDED),
"notify_recently_added_grandparent": checked(plexpy.CONFIG.NOTIFY_RECENTLY_ADDED_GRANDPARENT), "notify_recently_added_grandparent": checked(plexpy.CONFIG.NOTIFY_RECENTLY_ADDED_GRANDPARENT),
"notify_recently_added_delay": plexpy.CONFIG.NOTIFY_RECENTLY_ADDED_DELAY, "notify_recently_added_delay": plexpy.CONFIG.NOTIFY_RECENTLY_ADDED_DELAY,
"notify_concurrent_by_ip": plexpy.CONFIG.NOTIFY_CONCURRENT_BY_IP,
"notify_concurrent_threshold": plexpy.CONFIG.NOTIFY_CONCURRENT_THRESHOLD,
"notify_watched_percent": plexpy.CONFIG.NOTIFY_WATCHED_PERCENT, "notify_watched_percent": plexpy.CONFIG.NOTIFY_WATCHED_PERCENT,
"notify_on_start_subject_text": plexpy.CONFIG.NOTIFY_ON_START_SUBJECT_TEXT, "notify_on_start_subject_text": plexpy.CONFIG.NOTIFY_ON_START_SUBJECT_TEXT,
"notify_on_start_body_text": plexpy.CONFIG.NOTIFY_ON_START_BODY_TEXT, "notify_on_start_body_text": plexpy.CONFIG.NOTIFY_ON_START_BODY_TEXT,
@ -2594,6 +2596,8 @@ class WebInterface(object):
"notify_on_intup_body_text": plexpy.CONFIG.NOTIFY_ON_INTUP_BODY_TEXT, "notify_on_intup_body_text": plexpy.CONFIG.NOTIFY_ON_INTUP_BODY_TEXT,
"notify_on_pmsupdate_subject_text": plexpy.CONFIG.NOTIFY_ON_PMSUPDATE_SUBJECT_TEXT, "notify_on_pmsupdate_subject_text": plexpy.CONFIG.NOTIFY_ON_PMSUPDATE_SUBJECT_TEXT,
"notify_on_pmsupdate_body_text": plexpy.CONFIG.NOTIFY_ON_PMSUPDATE_BODY_TEXT, "notify_on_pmsupdate_body_text": plexpy.CONFIG.NOTIFY_ON_PMSUPDATE_BODY_TEXT,
"notify_on_concurrent_subject_text": plexpy.CONFIG.NOTIFY_ON_CONCURRENT_SUBJECT_TEXT,
"notify_on_concurrent_body_text": plexpy.CONFIG.NOTIFY_ON_CONCURRENT_BODY_TEXT,
"notify_scripts_args_text": plexpy.CONFIG.NOTIFY_SCRIPTS_ARGS_TEXT, "notify_scripts_args_text": plexpy.CONFIG.NOTIFY_SCRIPTS_ARGS_TEXT,
"home_sections": json.dumps(plexpy.CONFIG.HOME_SECTIONS), "home_sections": json.dumps(plexpy.CONFIG.HOME_SECTIONS),
"home_stats_length": plexpy.CONFIG.HOME_STATS_LENGTH, "home_stats_length": plexpy.CONFIG.HOME_STATS_LENGTH,