mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-11 07:46:07 -07:00
Remove global notification toggles
This commit is contained in:
parent
c7063b5973
commit
f5969f271a
4 changed files with 28 additions and 47 deletions
|
@ -779,27 +779,6 @@
|
|||
</div>
|
||||
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" name="movie_notify_enable" id="movie_notify_enable" value="1" ${config['movie_notify_enable']}> Enable Movie Notifications
|
||||
</label>
|
||||
</div>
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" name="tv_notify_enable" id="tv_notify_enable" value="1" ${config['tv_notify_enable']}> Enable TV Show Notifications
|
||||
</label>
|
||||
</div>
|
||||
<div class="checkbox">
|
||||
<label>
|
||||
<input type="checkbox" name="music_notify_enable" id="music_notify_enable" value="1" ${config['music_notify_enable']}> Enable Music Notifications
|
||||
</label>
|
||||
</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="checkbox" style="padding-top: 15px;">
|
||||
<label>
|
||||
<input type="checkbox" name="notify_upload_posters" id="notify_upload_posters" value="1" ${config['notify_upload_posters']}> Enable Posters in Notifications
|
||||
</label>
|
||||
|
|
|
@ -402,9 +402,7 @@ def start():
|
|||
|
||||
if _INITIALIZED:
|
||||
# Start background notification thread
|
||||
if any([CONFIG.MOVIE_NOTIFY_ENABLE, CONFIG.TV_NOTIFY_ENABLE,
|
||||
CONFIG.MUSIC_NOTIFY_ENABLE, CONFIG.NOTIFY_RECENTLY_ADDED]):
|
||||
notification_handler.start_threads(num_threads=CONFIG.NOTIFICATION_THREADS)
|
||||
notification_handler.start_threads(num_threads=CONFIG.NOTIFICATION_THREADS)
|
||||
|
||||
_STARTED = True
|
||||
|
||||
|
|
|
@ -118,11 +118,9 @@ def add_notifier_each(notify_action=None, stream_data=None, timeline_data=None,
|
|||
|
||||
|
||||
def notify_conditions(notifier=None, notify_action=None, stream_data=None, timeline_data=None):
|
||||
# Activity notifications
|
||||
if stream_data:
|
||||
|
||||
if stream_data['media_type'] == 'clip':
|
||||
return False
|
||||
|
||||
# Check if notifications enabled for user and library
|
||||
user_data = users.Users()
|
||||
user_details = user_data.get_details(user_id=stream_data['user_id'])
|
||||
|
@ -133,36 +131,45 @@ def notify_conditions(notifier=None, notify_action=None, stream_data=None, timel
|
|||
if not user_details['do_notify']:
|
||||
# logger.debug(u"PlexPy NotificationHandler :: Notifications for user '%s' is disabled." % user_details['username'])
|
||||
return False
|
||||
elif not library_details['do_notify']:
|
||||
|
||||
elif not library_details['do_notify'] and notify_action not in ('on_concurrent', 'on_newdevice'):
|
||||
# logger.debug(u"PlexPy NotificationHandler :: Notifications for library '%s' is disabled." % library_details['section_name'])
|
||||
return False
|
||||
|
||||
if (stream_data['media_type'] == 'movie' and plexpy.CONFIG.MOVIE_NOTIFY_ENABLE) \
|
||||
or (stream_data['media_type'] == 'episode' and plexpy.CONFIG.TV_NOTIFY_ENABLE):
|
||||
|
||||
progress_percent = helpers.get_percent(stream_data['view_offset'], stream_data['duration'])
|
||||
|
||||
if notify_action == 'on_concurrent':
|
||||
ap = activity_processor.ActivityProcessor()
|
||||
user_sessions = ap.get_sessions(user_id=stream_data['user_id'],
|
||||
ip_address=plexpy.CONFIG.NOTIFY_CONCURRENT_BY_IP)
|
||||
return len(user_sessions) >= plexpy.CONFIG.NOTIFY_CONCURRENT_THRESHOLD
|
||||
|
||||
elif notify_action == 'on_newdevice':
|
||||
data_factory = datafactory.DataFactory()
|
||||
user_devices = data_factory.get_user_devices(user_id=stream_data['user_id'])
|
||||
return stream_data['machine_id'] not in user_devices
|
||||
|
||||
conditions = \
|
||||
{'on_stop': plexpy.CONFIG.NOTIFY_CONSECUTIVE or progress_percent < plexpy.CONFIG.NOTIFY_WATCHED_PERCENT,
|
||||
'on_resume': plexpy.CONFIG.NOTIFY_CONSECUTIVE or progress_percent < 99,
|
||||
'on_concurrent': len(user_sessions) >= plexpy.CONFIG.NOTIFY_CONCURRENT_THRESHOLD,
|
||||
'on_newdevice': stream_data['machine_id'] not in user_devices
|
||||
}
|
||||
elif stream_data['media_type'] == 'movie' or stream_data['media_type'] == 'episode':
|
||||
progress_percent = helpers.get_percent(stream_data['view_offset'], stream_data['duration'])
|
||||
|
||||
return conditions.get(notify_action, True)
|
||||
if notify_action == 'on_stop':
|
||||
return plexpy.CONFIG.NOTIFY_CONSECUTIVE or progress_percent < plexpy.CONFIG.NOTIFY_WATCHED_PERCENT
|
||||
|
||||
elif (stream_data['media_type'] == 'track' and plexpy.CONFIG.MUSIC_NOTIFY_ENABLE):
|
||||
elif notify_action == 'on_resume':
|
||||
return plexpy.CONFIG.NOTIFY_CONSECUTIVE or progress_percent < 99
|
||||
|
||||
# All other activity notify actions
|
||||
else:
|
||||
return True
|
||||
|
||||
elif stream_data['media_type'] == 'track':
|
||||
return True
|
||||
|
||||
else:
|
||||
return False
|
||||
|
||||
# Recently Added notifications
|
||||
elif timeline_data:
|
||||
|
||||
# Check if notifications enabled for library
|
||||
library_data = libraries.Libraries()
|
||||
library_details = library_data.get_details(section_id=timeline_data['section_id'])
|
||||
|
||||
|
@ -171,6 +178,8 @@ def notify_conditions(notifier=None, notify_action=None, stream_data=None, timel
|
|||
return False
|
||||
|
||||
return True
|
||||
|
||||
# Server notifications
|
||||
else:
|
||||
return True
|
||||
|
||||
|
|
|
@ -2584,9 +2584,6 @@ class WebInterface(object):
|
|||
"grouping_global_history": checked(plexpy.CONFIG.GROUPING_GLOBAL_HISTORY),
|
||||
"grouping_user_history": checked(plexpy.CONFIG.GROUPING_USER_HISTORY),
|
||||
"grouping_charts": checked(plexpy.CONFIG.GROUPING_CHARTS),
|
||||
"movie_notify_enable": checked(plexpy.CONFIG.MOVIE_NOTIFY_ENABLE),
|
||||
"tv_notify_enable": checked(plexpy.CONFIG.TV_NOTIFY_ENABLE),
|
||||
"music_notify_enable": checked(plexpy.CONFIG.MUSIC_NOTIFY_ENABLE),
|
||||
"monitor_pms_updates": checked(plexpy.CONFIG.MONITOR_PMS_UPDATES),
|
||||
"monitor_remote_access": checked(plexpy.CONFIG.MONITOR_REMOTE_ACCESS),
|
||||
"monitoring_interval": plexpy.CONFIG.MONITORING_INTERVAL,
|
||||
|
@ -2601,7 +2598,6 @@ class WebInterface(object):
|
|||
"pms_is_remote": checked(plexpy.CONFIG.PMS_IS_REMOTE),
|
||||
"notify_consecutive": checked(plexpy.CONFIG.NOTIFY_CONSECUTIVE),
|
||||
"notify_upload_posters": checked(plexpy.CONFIG.NOTIFY_UPLOAD_POSTERS),
|
||||
"notify_recently_added": checked(plexpy.CONFIG.NOTIFY_RECENTLY_ADDED),
|
||||
"notify_recently_added_upgrade": checked(plexpy.CONFIG.NOTIFY_RECENTLY_ADDED_UPGRADE),
|
||||
"notify_group_recently_added_grandparent": checked(plexpy.CONFIG.NOTIFY_GROUP_RECENTLY_ADDED_GRANDPARENT),
|
||||
"notify_group_recently_added_parent": checked(plexpy.CONFIG.NOTIFY_GROUP_RECENTLY_ADDED_PARENT),
|
||||
|
@ -2639,10 +2635,9 @@ class WebInterface(object):
|
|||
"launch_browser", "enable_https", "https_create_cert", "api_enabled", "freeze_db", "check_github",
|
||||
"grouping_global_history", "grouping_user_history", "grouping_charts", "group_history_tables",
|
||||
"pms_use_bif", "pms_ssl", "pms_is_remote", "home_stats_type", "week_start_monday",
|
||||
"movie_notify_enable", "tv_notify_enable", "music_notify_enable",
|
||||
"refresh_libraries_on_startup", "refresh_users_on_startup",
|
||||
"movie_logging_enable", "tv_logging_enable", "music_logging_enable",
|
||||
"notify_consecutive", "notify_upload_posters", "notify_recently_added", "notify_recently_added_upgrade",
|
||||
"notify_consecutive", "notify_upload_posters", "notify_recently_added_upgrade",
|
||||
"notify_group_recently_added_grandparent", "notify_group_recently_added_parent",
|
||||
"monitor_pms_updates", "monitor_remote_access", "get_file_sizes", "log_blacklist", "http_hash_password",
|
||||
"allow_guest_access", "cache_images", "http_basic_auth", "notify_concurrent_by_ip",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue