Force reinstall of GeoLite2 database

This commit is contained in:
JonnyWong16 2019-12-25 13:43:12 -08:00
parent 0428df8e3f
commit ee91da2ff1
3 changed files with 3 additions and 4 deletions

View file

@ -1250,7 +1250,7 @@
<div class="input-group"> <div class="input-group">
<input type="text" class="form-control" id="geoip_db" name="geoip_db" value="${config['geoip_db']}" ${docker_setting}> <input type="text" class="form-control" id="geoip_db" name="geoip_db" value="${config['geoip_db']}" ${docker_setting}>
<span class="input-group-btn"> <span class="input-group-btn">
<button class="btn btn-form" type="button" id="install_geoip_db">${'Update' if config["geoip_db_installed"] > 1 else 'Install'}</button> <button class="btn btn-form" type="button" id="install_geoip_db">${'Update' if config["geoip_db_installed"] else 'Install'}</button>
<button class="btn btn-form" type="button" id="uninstall_geoip_db">Uninstall</button> <button class="btn btn-form" type="button" id="uninstall_geoip_db">Uninstall</button>
</span> </span>
</div> </div>
@ -2859,7 +2859,7 @@ $(document).ready(function() {
gotoSetting('3rd_party_apis', 'geoip_db') gotoSetting('3rd_party_apis', 'geoip_db')
} }
if ("${config['geoip_db_installed']}" > "1") { if ("${config['geoip_db_installed']}" > "0") {
$("#geoip_db_updated").text(moment("${config['geoip_db_installed']}", "X").fromNow()); $("#geoip_db_updated").text(moment("${config['geoip_db_installed']}", "X").fromNow());
} }

View file

@ -928,7 +928,6 @@ class Config(object):
self.CONFIG_VERSION = 13 self.CONFIG_VERSION = 13
if self.CONFIG_VERSION == 13: if self.CONFIG_VERSION == 13:
self.GEOIP_DB_INSTALLED = int(bool(self.GEOIP_DB))
if not self.GEOIP_DB: if not self.GEOIP_DB:
self.GEOIP_DB = os.path.join(plexpy.DATA_DIR, 'GeoLite2-City.mmdb') self.GEOIP_DB = os.path.join(plexpy.DATA_DIR, 'GeoLite2-City.mmdb')

View file

@ -585,7 +585,7 @@ def is_valid_ip(address):
def update_geoip_db(): def update_geoip_db():
if plexpy.CONFIG.GEOIP_DB_INSTALLED > 1: if plexpy.CONFIG.GEOIP_DB_INSTALLED:
logger.info(u"Tautulli Helpers :: Checking for GeoLite2 database updates.") logger.info(u"Tautulli Helpers :: Checking for GeoLite2 database updates.")
now = int(time.time()) now = int(time.time())
if now - plexpy.CONFIG.GEOIP_DB_INSTALLED >= plexpy.CONFIG.GEOIP_DB_UPDATE_DAYS * 24 * 60 * 60: if now - plexpy.CONFIG.GEOIP_DB_INSTALLED >= plexpy.CONFIG.GEOIP_DB_UPDATE_DAYS * 24 * 60 * 60: