Remove global logging toggles

This commit is contained in:
JonnyWong16 2017-04-22 12:44:46 -07:00
parent 77b0f69b0c
commit 7c0c7eea30
6 changed files with 41 additions and 29 deletions

View file

@ -715,22 +715,6 @@
<h3>History Logging</h3> <h3>History Logging</h3>
</div> </div>
<p class="help-block">Keep records of all movie, TV show, or music items played from your Plex Media Server.</p>
<div class="checkbox">
<label>
<input type="checkbox" id="movie_logging_enable" name="movie_logging_enable" value="1" ${config['movie_logging_enable']}> Enable Movie Logging
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="tv_logging_enable" name="tv_logging_enable" value="1" ${config['tv_logging_enable']}> Enable TV Show Logging
</label>
</div>
<div class="checkbox">
<label>
<input type="checkbox" id="music_logging_enable" name="music_logging_enable" value="1" ${config['music_logging_enable']}> Enable Music Logging
</label>
</div>
<div class="form-group"> <div class="form-group">
<label for="logging_ignore_interval">Ignore Interval</label> <label for="logging_ignore_interval">Ignore Interval</label>
<div class="row"> <div class="row">

View file

@ -1079,6 +1079,8 @@ def dbcheck():
def upgrade(): def upgrade():
if CONFIG.UPDATE_NOTIFIERS_DB: if CONFIG.UPDATE_NOTIFIERS_DB:
notifiers.upgrade_config_to_db() notifiers.upgrade_config_to_db()
if CONFIG.UPDATE_LIBRARIES_DB_NOTIFY:
libraries.update_libraries_db_notify()
def shutdown(restart=False, update=False, checkout=False): def shutdown(restart=False, update=False, checkout=False):
cherrypy.engine.exit() cherrypy.engine.exit()

View file

@ -138,14 +138,7 @@ class ActivityProcessor(object):
state='stopped', state='stopped',
stopped=stopped) stopped=stopped)
if plexpy.CONFIG.MOVIE_LOGGING_ENABLE and str(session['rating_key']).isdigit() and \ if str(session['rating_key']).isdigit() and session['media_type'] in ('movie', 'episode', 'track'):
session['media_type'] == 'movie':
logging_enabled = True
elif plexpy.CONFIG.TV_LOGGING_ENABLE and str(session['rating_key']).isdigit() and \
session['media_type'] == 'episode':
logging_enabled = True
elif plexpy.CONFIG.MUSIC_LOGGING_ENABLE and str(session['rating_key']).isdigit() and \
session['media_type'] == 'track':
logging_enabled = True logging_enabled = True
else: else:
logger.debug(u"PlexPy ActivityProcessor :: ratingKey %s not logged. Does not meet logging criteria. " logger.debug(u"PlexPy ActivityProcessor :: ratingKey %s not logged. Does not meet logging criteria. "

View file

@ -574,6 +574,7 @@ _CONFIG_DEFINITIONS = {
'UPDATE_SECTION_IDS': (int, 'General', 1), 'UPDATE_SECTION_IDS': (int, 'General', 1),
'UPDATE_SHOW_CHANGELOG': (int, 'General', 1), 'UPDATE_SHOW_CHANGELOG': (int, 'General', 1),
'UPDATE_LABELS': (int, 'General', 1), 'UPDATE_LABELS': (int, 'General', 1),
'UPDATE_LIBRARIES_DB_NOTIFY': (int, 'General', 1),
'UPDATE_NOTIFIERS_DB': (int, 'General', 1), 'UPDATE_NOTIFIERS_DB': (int, 'General', 1),
'VERIFY_SSL_CERT': (bool_int, 'Advanced', 1), 'VERIFY_SSL_CERT': (bool_int, 'Advanced', 1),
'VIDEO_LOGGING_ENABLE': (int, 'Monitoring', 1), 'VIDEO_LOGGING_ENABLE': (int, 'Monitoring', 1),

View file

@ -977,3 +977,39 @@ class Libraries(object):
return 'Deleted duplicate libraries from the database.' return 'Deleted duplicate libraries from the database.'
except Exception as e: except Exception as e:
logger.warn(u"PlexPy Libraries :: Unable to delete duplicate libraries: %s." % e) logger.warn(u"PlexPy Libraries :: Unable to delete duplicate libraries: %s." % e)
def update_libraries_db_notify():
logger.info(u"PlexPy Libraries :: Upgrading library notification toggles...")
# Set flag first in case something fails we don't want to keep re-adding the notifiers
plexpy.CONFIG.__setattr__('UPDATE_LIBRARIES_DB_NOTIFY', 0)
plexpy.CONFIG.write()
libraries = Libraries()
sections = libraries.get_sections()
for section in sections:
section_details = libraries.get_details(section['section_id'])
if (section_details['do_notify'] == 1 and
(section_details['section_type'] == 'movie' and not plexpy.CONFIG.MOVIE_NOTIFY_ENABLE) or
(section_details['section_type'] == 'show' and not plexpy.CONFIG.TV_NOTIFY_ENABLE) or
(section_details['section_type'] == 'artist' and not plexpy.CONFIG.MUSIC_NOTIFY_ENABLE)):
do_notify = 0
else:
do_notify = section_details['do_notify']
if (section_details['keep_history'] == 1 and
(section_details['section_type'] == 'movie' and not plexpy.CONFIG.MOVIE_LOGGING_ENABLE) or
(section_details['section_type'] == 'show' and not plexpy.CONFIG.TV_LOGGING_ENABLE) or
(section_details['section_type'] == 'artist' and not plexpy.CONFIG.MUSIC_LOGGING_ENABLE)):
keep_history = 0
else:
keep_history = section_details['keep_history']
libraries.set_config(section_id=section_details['section_id'],
custom_thumb=section_details['library_thumb'],
do_notify=do_notify,
keep_history=keep_history,
do_notify_created=section_details['do_notify_created'])

View file

@ -2591,9 +2591,6 @@ class WebInterface(object):
"refresh_libraries_on_startup": checked(plexpy.CONFIG.REFRESH_LIBRARIES_ON_STARTUP), "refresh_libraries_on_startup": checked(plexpy.CONFIG.REFRESH_LIBRARIES_ON_STARTUP),
"refresh_users_interval": plexpy.CONFIG.REFRESH_USERS_INTERVAL, "refresh_users_interval": plexpy.CONFIG.REFRESH_USERS_INTERVAL,
"refresh_users_on_startup": checked(plexpy.CONFIG.REFRESH_USERS_ON_STARTUP), "refresh_users_on_startup": checked(plexpy.CONFIG.REFRESH_USERS_ON_STARTUP),
"movie_logging_enable": checked(plexpy.CONFIG.MOVIE_LOGGING_ENABLE),
"tv_logging_enable": checked(plexpy.CONFIG.TV_LOGGING_ENABLE),
"music_logging_enable": checked(plexpy.CONFIG.MUSIC_LOGGING_ENABLE),
"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),
@ -2636,7 +2633,6 @@ class WebInterface(object):
"grouping_global_history", "grouping_user_history", "grouping_charts", "group_history_tables", "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", "pms_use_bif", "pms_ssl", "pms_is_remote", "home_stats_type", "week_start_monday",
"refresh_libraries_on_startup", "refresh_users_on_startup", "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_upgrade", "notify_consecutive", "notify_upload_posters", "notify_recently_added_upgrade",
"notify_group_recently_added_grandparent", "notify_group_recently_added_parent", "notify_group_recently_added_grandparent", "notify_group_recently_added_parent",
"monitor_pms_updates", "monitor_remote_access", "get_file_sizes", "log_blacklist", "http_hash_password", "monitor_pms_updates", "monitor_remote_access", "get_file_sizes", "log_blacklist", "http_hash_password",