From 41be7d15d0bddef44f2dce7c5e7e58ea8f4a6274 Mon Sep 17 00:00:00 2001 From: mac12m99 <10120390+mac12m99@users.noreply.github.com> Date: Thu, 11 Feb 2021 20:13:08 +0100 Subject: [PATCH] fix mancata chiusura db ed errore in caso di annullamento aggiunta film in videoteca --- core/videolibrarytools.py | 21 ++++++++++----------- platformcode/launcher.py | 4 ++++ 2 files changed, 14 insertions(+), 11 deletions(-) diff --git a/core/videolibrarytools.py b/core/videolibrarytools.py index 69f27f3c..bababbf4 100644 --- a/core/videolibrarytools.py +++ b/core/videolibrarytools.py @@ -1007,21 +1007,20 @@ def add_movie(item): # If you do it in "Enter another name", TMDB will automatically search for the new title # If you do it in "Complete Information", it partially changes to the new title, but does not search TMDB. We have to do it # If the second screen is canceled, the variable "scraper_return" will be False. The user does not want to continue - item = generictools.update_title(item) # We call the method that updates the title with tmdb.find_and_set_infoLabels #if item.tmdb_stat: # del item.tmdb_stat # We clean the status so that it is not recorded in the Video Library - # if item: - new_item = item.clone(action="findvideos") - insertados, sobreescritos, fallidos, path = save_movie(new_item) + if item: + new_item = item.clone(action="findvideos") + insertados, sobreescritos, fallidos, path = save_movie(new_item) - if fallidos == 0: - platformtools.dialog_ok(config.get_localized_string(30131), - config.get_localized_string(30135) % new_item.contentTitle) # 'has been added to the video library' - else: - filetools.rmdirtree(path) - platformtools.dialog_ok(config.get_localized_string(30131), - config.get_localized_string(60066) % new_item.contentTitle) # "ERROR, the movie has NOT been added to the video library") + if fallidos == 0: + platformtools.dialog_ok(config.get_localized_string(30131), + config.get_localized_string(30135) % new_item.contentTitle) # 'has been added to the video library' + else: + filetools.rmdirtree(path) + platformtools.dialog_ok(config.get_localized_string(30131), + config.get_localized_string(60066) % new_item.contentTitle) # "ERROR, the movie has NOT been added to the video library") def add_tvshow(item, channel=None): diff --git a/platformcode/launcher.py b/platformcode/launcher.py index a84cfe45..989e2d77 100644 --- a/platformcode/launcher.py +++ b/platformcode/launcher.py @@ -342,6 +342,10 @@ def run(item=None): else: if platformtools.dialog_yesno(config.get_localized_string(60038), config.get_localized_string(60015)): run(Item(channel="setting", action="report_menu")) + finally: + if not item.action.startswith('play'): + from core import db + db.close() def new_search(item, channel=None):