Add setting for GeoLite2 database update interval

This commit is contained in:
JonnyWong16 2019-12-25 12:51:59 -08:00
commit 3b44a3afd2
4 changed files with 14 additions and 2 deletions

View file

@ -176,6 +176,7 @@ _CONFIG_DEFINITIONS = {
'FREEZE_DB': (int, 'General', 0),
'GEOIP_DB': (str, 'General', ''),
'GEOIP_DB_INSTALLED': (int, 'General', 0),
'GEOIP_DB_UPDATE_DAYS': (int, 'General', 30),
'GET_FILE_SIZES': (int, 'General', 0),
'GET_FILE_SIZES_HOLD': (dict, 'General', {'section_ids': [], 'rating_keys': []}),
'GIT_BRANCH': (str, 'General', 'master'),

View file

@ -588,7 +588,7 @@ def update_geoip_db():
if plexpy.CONFIG.GEOIP_DB_INSTALLED > 1:
logger.info(u"Tautulli Helpers :: Checking for GeoLite2 database updates.")
now = int(time.time())
if now - plexpy.CONFIG.GEOIP_DB_INSTALLED >= 2592000: # 30 days
if now - plexpy.CONFIG.GEOIP_DB_INSTALLED >= plexpy.CONFIG.GEOIP_DB_UPDATE_DAYS * 24 * 60 * 60:
return install_geoip_db(update=True)
logger.info(u"Tautulli Helpers :: GeoLite2 database already updated within the last 30 days.")

View file

@ -2820,9 +2820,10 @@ class WebInterface(object):
"newsletter_inline_styles": checked(plexpy.CONFIG.NEWSLETTER_INLINE_STYLES),
"newsletter_custom_dir": plexpy.CONFIG.NEWSLETTER_CUSTOM_DIR,
"win_sys_tray": checked(plexpy.CONFIG.WIN_SYS_TRAY),
"maxmind_license_key": plexpy.CONFIG.MAXMIND_LICENSE_KEY,
"geoip_db": plexpy.CONFIG.GEOIP_DB,
"geoip_db_installed": plexpy.CONFIG.GEOIP_DB_INSTALLED,
"maxmind_license_key": plexpy.CONFIG.MAXMIND_LICENSE_KEY
"geoip_db_update_days": plexpy.CONFIG.GEOIP_DB_UPDATE_DAYS
}
return serve_template(templatename="settings.html", title="Settings", config=config, kwargs=kwargs)