mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-11 07:46:07 -07:00
Copy database path to cache and delete after importing
This commit is contained in:
parent
0f2dbf2c94
commit
5ca5f24a66
2 changed files with 12 additions and 2 deletions
|
@ -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()
|
||||
|
|
|
@ -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:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue