diff --git a/plexpy/database.py b/plexpy/database.py index dd5ee4de..ac792f75 100644 --- a/plexpy/database.py +++ b/plexpy/database.py @@ -211,6 +211,9 @@ def import_tautulli_db(database=None, method=None, backup=False): logger.info("Tautulli Database :: Tautulli database import complete.") set_is_importing(False) + logger.info("Tautulli Database :: Deleting cached database: %s", database) + os.remove(database) + def integrity_check(): monitor_db = MonitorDatabase() diff --git a/plexpy/webserve.py b/plexpy/webserve.py index f445c0cb..4ddc24d3 100644 --- a/plexpy/webserve.py +++ b/plexpy/webserve.py @@ -3914,9 +3914,16 @@ class WebInterface(object): if not app: return {'result': 'error', 'message': 'No app specified for import'} - if database_file: + if database_path: + database_file_name = os.path.basename(database_path) + database_cache_path = os.path.join(plexpy.CONFIG.CACHE_DIR, database_file_name + '.import.db') + logger.info("Received database file '%s' for import. Saving to cache: %s", + database_file_name, database_cache_path) + database_path = shutil.copyfile(database_path, database_cache_path) + + elif database_file: database_path = os.path.join(plexpy.CONFIG.CACHE_DIR, database_file.filename + '.import.db') - logger.info("Received database file '%s' for import. Saving to cache '%s'.", + logger.info("Received database file '%s' for import. Saving to cache: %s", database_file.filename, database_path) with open(database_path, 'wb') as f: while True: