From b29695acc596d22165bf6fa1bd241785f7f982a1 Mon Sep 17 00:00:00 2001 From: Alhaziel Date: Thu, 1 Aug 2019 17:38:37 +0200 Subject: [PATCH] Download nelle rispettive cartelle della videoteca --- core/videolibrarytools.py | 6 +++--- specials/downloads.py | 13 +++++++------ 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/core/videolibrarytools.py b/core/videolibrarytools.py index 4b648f55..c70b62a6 100644 --- a/core/videolibrarytools.py +++ b/core/videolibrarytools.py @@ -340,7 +340,7 @@ def save_tvshow(item, episodelist): '''msg = "Insertados: %d | Sobreescritos: %d | Fallidos: %d | Tiempo: %2.2f segundos" % \ (insertados, sobreescritos, fallidos, time.time() - start_time) logger.debug(msg)''' - + return insertados, sobreescritos, fallidos, path @@ -398,8 +398,8 @@ def save_episodes(path, episodelist, serie, silent=False, overwrite=True): channel_alt = generictools.verify_channel(serie.channel) #Preparamos para añadir las urls de emergencia emergency_urls_stat = config.get_setting("emergency_urls", channel_alt) #El canal quiere urls de emergencia? emergency_urls_succ = False - #channel = __import__('channels.%s' % channel_alt, fromlist=["channels.%s" % channel_alt]) - channel = __import__('specials.%s' % channel_alt, fromlist=["specials.%s" % channel_alt]) + try: channel = __import__('specials.%s' % channel_alt, fromlist=["specials.%s" % channel_alt]) + except: channel = __import__('channels.%s' % channel_alt, fromlist=["channels.%s" % channel_alt]) if serie.torrent_caching_fail: #Si el proceso de conversión ha fallado, no se cachean emergency_urls_stat = 0 del serie.torrent_caching_fail diff --git a/specials/downloads.py b/specials/downloads.py index 0673d1d6..6d2147db 100644 --- a/specials/downloads.py +++ b/specials/downloads.py @@ -263,9 +263,10 @@ def menu(item): def move_to_libray(item): download_path = filetools.join(config.get_setting("downloadpath"), item.downloadFilename) - library_path = filetools.join(config.get_videolibrary_path(), *filetools.split(item.downloadFilename)) + library_path = filetools.join(config.get_videolibrary_path(), (config.get_setting("folder_movies") if item.contentType == 'movie' else config.get_setting("folder_tvshows"))) + library_path = filetools.join(library_path, *filetools.split(item.downloadFilename)) final_path = download_path - + if config.get_setting("library_add", "downloads") == True and config.get_setting("library_move", "downloads") == True: if not filetools.isdir(filetools.dirname(library_path)): filetools.mkdir(filetools.dirname(library_path)) @@ -293,7 +294,7 @@ def move_to_libray(item): tvshow = Item(channel="downloads", contentType="tvshow", infoLabels={"tmdb_id": item.infoLabels["tmdb_id"]}) videolibrarytools.save_tvshow(tvshow, [library_item]) - + def update_json(path, params): item = Item().fromjson(filetools.read(path)) @@ -804,7 +805,7 @@ def save_download_movie(item): progreso.update(0, config.get_localized_string(60062)) - item.downloadFilename = filetools.validate_path("%s [%s]" % (item.contentTitle.strip(), item.contentChannel)) + item.downloadFilename = filetools.validate_path("%s [%s] [%s]" % (item.contentTitle.strip(), item.contentChannel, item.infoLabels['IMDBNumber'])) write_json(item) @@ -825,8 +826,8 @@ def save_download_tvshow(item): item.show = item.fulltitle scraper.find_and_set_infoLabels(item) - - item.downloadFilename = filetools.validate_path("%s [%s]" % (item.contentSerieName, item.contentChannel)) + logger.info('ID= ' + item.infoLabels['IMDBNumber']) + item.downloadFilename = filetools.validate_path("%s [%s]" % (item.contentSerieName, item.infoLabels['IMDBNumber'])) progreso.update(0, config.get_localized_string(70186), config.get_localized_string(70187) % item.contentChannel)