mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-11 15:56:07 -07:00
Only schedule job for recently added or monitor remote access if setting enabled
This commit is contained in:
parent
112811f3e2
commit
89f581f63e
5 changed files with 45 additions and 21 deletions
|
@ -499,6 +499,11 @@ available_notification_agents = sorted(notifiers.available_notification_agents()
|
||||||
<input type="checkbox" name="music_notify_enable" id="music_notify_enable" value="1" ${config['music_notify_enable']}> Enable Music Notifications
|
<input type="checkbox" name="music_notify_enable" id="music_notify_enable" value="1" ${config['music_notify_enable']}> Enable Music Notifications
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="checkbox">
|
||||||
|
<label>
|
||||||
|
<input type="checkbox" name="notify_recently_added" id="notify_recently_added" value="1" ${config['notify_recently_added']}> Enable Recently Added Notifications
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="padded-header">
|
<div class="padded-header">
|
||||||
<h3>Current Activity Notifications</h3>
|
<h3>Current Activity Notifications</h3>
|
||||||
|
|
|
@ -285,10 +285,20 @@ def initialize_scheduler():
|
||||||
hours=12, minutes=0, seconds=0)
|
hours=12, minutes=0, seconds=0)
|
||||||
schedule_job(pmsconnect.get_server_friendly_name, 'Refresh Plex Server Name',
|
schedule_job(pmsconnect.get_server_friendly_name, 'Refresh Plex Server Name',
|
||||||
hours=12, minutes=0, seconds=0)
|
hours=12, minutes=0, seconds=0)
|
||||||
|
|
||||||
|
if CONFIG.NOTIFY_RECENTLY_ADDED:
|
||||||
schedule_job(activity_pinger.check_recently_added, 'Check for recently added items',
|
schedule_job(activity_pinger.check_recently_added, 'Check for recently added items',
|
||||||
hours=0, minutes=0, seconds=seconds)
|
hours=0, minutes=0, seconds=seconds)
|
||||||
|
else:
|
||||||
|
schedule_job(activity_pinger.check_recently_added, 'Check for recently added items',
|
||||||
|
hours=0, minutes=0, seconds=0)
|
||||||
|
|
||||||
|
if CONFIG.MONITOR_REMOTE_ACCESS:
|
||||||
schedule_job(activity_pinger.check_server_response, 'Check for server response',
|
schedule_job(activity_pinger.check_server_response, 'Check for server response',
|
||||||
hours=0, minutes=0, seconds=seconds)
|
hours=0, minutes=0, seconds=seconds)
|
||||||
|
else:
|
||||||
|
schedule_job(activity_pinger.check_server_response, 'Check for server response',
|
||||||
|
hours=0, minutes=0, seconds=0)
|
||||||
|
|
||||||
# If we're not using websockets then fall back to polling
|
# If we're not using websockets then fall back to polling
|
||||||
if not CONFIG.MONITORING_USE_WEBSOCKET or POLLING_FAILOVER:
|
if not CONFIG.MONITORING_USE_WEBSOCKET or POLLING_FAILOVER:
|
||||||
|
|
|
@ -33,7 +33,11 @@ def check_active_sessions(ws_request=False):
|
||||||
monitor_process = activity_processor.ActivityProcessor()
|
monitor_process = activity_processor.ActivityProcessor()
|
||||||
# logger.debug(u"PlexPy Monitor :: Checking for active streams.")
|
# logger.debug(u"PlexPy Monitor :: Checking for active streams.")
|
||||||
|
|
||||||
|
global int_ping_count
|
||||||
|
|
||||||
if session_list:
|
if session_list:
|
||||||
|
int_ping_count = 0
|
||||||
|
|
||||||
media_container = session_list['sessions']
|
media_container = session_list['sessions']
|
||||||
|
|
||||||
# Check our temp table for what we must do with the new streams
|
# Check our temp table for what we must do with the new streams
|
||||||
|
@ -165,6 +169,16 @@ def check_active_sessions(ws_request=False):
|
||||||
else:
|
else:
|
||||||
logger.debug(u"PlexPy Monitor :: Unable to read session list.")
|
logger.debug(u"PlexPy Monitor :: Unable to read session list.")
|
||||||
|
|
||||||
|
int_ping_count += 1
|
||||||
|
logger.warn(u"PlexPy Monitor :: Unable to get an internal response from the server, ping attempt %s." \
|
||||||
|
% str(int_ping_count))
|
||||||
|
|
||||||
|
if int_ping_count == 3:
|
||||||
|
# Fire off notifications
|
||||||
|
threading.Thread(target=notification_handler.notify_timeline,
|
||||||
|
kwargs=dict(notify_action='intdown')).start()
|
||||||
|
|
||||||
|
|
||||||
def check_recently_added():
|
def check_recently_added():
|
||||||
|
|
||||||
with monitor_lock:
|
with monitor_lock:
|
||||||
|
@ -231,20 +245,10 @@ def check_server_response():
|
||||||
pms_connect = pmsconnect.PmsConnect()
|
pms_connect = pmsconnect.PmsConnect()
|
||||||
server_response = pms_connect.get_server_response()
|
server_response = pms_connect.get_server_response()
|
||||||
|
|
||||||
global int_ping_count
|
|
||||||
global ext_ping_count
|
global ext_ping_count
|
||||||
|
|
||||||
# Check for internal server response
|
|
||||||
if not server_response:
|
|
||||||
int_ping_count += 1
|
|
||||||
logger.warn(u"PlexPy Monitor :: Unable to get an internal response from the server, ping attempt %s." \
|
|
||||||
% str(int_ping_count))
|
|
||||||
# Reset internal ping counter
|
|
||||||
else:
|
|
||||||
int_ping_count = 0
|
|
||||||
|
|
||||||
# Check for remote access
|
# Check for remote access
|
||||||
if server_response and plexpy.CONFIG.MONITOR_REMOTE_ACCESS:
|
if server_response:
|
||||||
|
|
||||||
mapping_state = server_response['mapping_state']
|
mapping_state = server_response['mapping_state']
|
||||||
mapping_error = server_response['mapping_error']
|
mapping_error = server_response['mapping_error']
|
||||||
|
@ -263,11 +267,6 @@ def check_server_response():
|
||||||
else:
|
else:
|
||||||
ext_ping_count = 0
|
ext_ping_count = 0
|
||||||
|
|
||||||
if int_ping_count == 3:
|
|
||||||
# Fire off notifications
|
|
||||||
threading.Thread(target=notification_handler.notify_timeline,
|
|
||||||
kwargs=dict(notify_action='intdown')).start()
|
|
||||||
|
|
||||||
if ext_ping_count == 3:
|
if ext_ping_count == 3:
|
||||||
# Fire off notifications
|
# Fire off notifications
|
||||||
threading.Thread(target=notification_handler.notify_timeline,
|
threading.Thread(target=notification_handler.notify_timeline,
|
||||||
|
|
|
@ -151,6 +151,7 @@ _CONFIG_DEFINITIONS = {
|
||||||
'NMA_ON_EXTDOWN': (int, 'NMA', 0),
|
'NMA_ON_EXTDOWN': (int, 'NMA', 0),
|
||||||
'NMA_ON_INTDOWN': (int, 'NMA', 0),
|
'NMA_ON_INTDOWN': (int, 'NMA', 0),
|
||||||
'NOTIFY_CONSECUTIVE': (int, 'Monitoring', 1),
|
'NOTIFY_CONSECUTIVE': (int, 'Monitoring', 1),
|
||||||
|
'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_WATCHED_PERCENT': (int, 'Monitoring', 85),
|
'NOTIFY_WATCHED_PERCENT': (int, 'Monitoring', 85),
|
||||||
|
|
|
@ -448,6 +448,7 @@ class WebInterface(object):
|
||||||
"logging_ignore_interval": plexpy.CONFIG.LOGGING_IGNORE_INTERVAL,
|
"logging_ignore_interval": plexpy.CONFIG.LOGGING_IGNORE_INTERVAL,
|
||||||
"pms_is_remote": checked(plexpy.CONFIG.PMS_IS_REMOTE),
|
"pms_is_remote": checked(plexpy.CONFIG.PMS_IS_REMOTE),
|
||||||
"notify_consecutive": checked(plexpy.CONFIG.NOTIFY_CONSECUTIVE),
|
"notify_consecutive": checked(plexpy.CONFIG.NOTIFY_CONSECUTIVE),
|
||||||
|
"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_watched_percent": plexpy.CONFIG.NOTIFY_WATCHED_PERCENT,
|
"notify_watched_percent": plexpy.CONFIG.NOTIFY_WATCHED_PERCENT,
|
||||||
|
@ -494,7 +495,7 @@ class WebInterface(object):
|
||||||
"tv_notify_on_pause", "movie_notify_on_pause", "music_notify_on_pause", "refresh_users_on_startup",
|
"tv_notify_on_pause", "movie_notify_on_pause", "music_notify_on_pause", "refresh_users_on_startup",
|
||||||
"ip_logging_enable", "movie_logging_enable", "tv_logging_enable", "music_logging_enable",
|
"ip_logging_enable", "movie_logging_enable", "tv_logging_enable", "music_logging_enable",
|
||||||
"pms_is_remote", "home_stats_type", "group_history_tables", "notify_consecutive",
|
"pms_is_remote", "home_stats_type", "group_history_tables", "notify_consecutive",
|
||||||
"notify_recently_added_grandparent", "monitor_remote_access"
|
"notify_recently_added", "notify_recently_added_grandparent", "monitor_remote_access"
|
||||||
]
|
]
|
||||||
for checked_config in checked_configs:
|
for checked_config in checked_configs:
|
||||||
if checked_config not in kwargs:
|
if checked_config not in kwargs:
|
||||||
|
@ -520,6 +521,14 @@ class WebInterface(object):
|
||||||
(kwargs['refresh_users_interval'] != str(plexpy.CONFIG.REFRESH_USERS_INTERVAL)):
|
(kwargs['refresh_users_interval'] != str(plexpy.CONFIG.REFRESH_USERS_INTERVAL)):
|
||||||
reschedule = True
|
reschedule = True
|
||||||
|
|
||||||
|
if 'notify_recently_added' in kwargs and \
|
||||||
|
(kwargs['notify_recently_added'] != plexpy.CONFIG.NOTIFY_RECENTLY_ADDED):
|
||||||
|
reschedule = True
|
||||||
|
|
||||||
|
if 'monitor_remote_access' in kwargs and \
|
||||||
|
(kwargs['monitor_remote_access'] != plexpy.CONFIG.MONITOR_REMOTE_ACCESS):
|
||||||
|
reschedule = True
|
||||||
|
|
||||||
if 'pms_ip' in kwargs:
|
if 'pms_ip' in kwargs:
|
||||||
if kwargs['pms_ip'] != plexpy.CONFIG.PMS_IP:
|
if kwargs['pms_ip'] != plexpy.CONFIG.PMS_IP:
|
||||||
refresh_users = True
|
refresh_users = True
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue