From ad59f4e03feed97edad5779d124c4a061b59d913 Mon Sep 17 00:00:00 2001 From: axlt2002 Date: Fri, 8 May 2020 18:09:51 +0200 Subject: [PATCH] Supporto episodi locali + revisione metodo clean + alcuni fix + revisione strings.po --- core/videolibrarytools.py | 103 ++++++++++--- platformcode/config.py | 4 +- platformcode/xbmc_videolibrary.py | 173 ++++++++-------------- resources/language/English/strings.po | 122 +++++++++------ resources/language/Italian/strings.po | 204 +++++++++++++++----------- resources/settings.xml | 14 +- specials/backup.py | 17 +-- specials/downloads.py | 5 +- specials/shortcuts.py | 8 +- specials/videolibrary.json | 137 ++++++++--------- specials/videolibrary.py | 169 ++++++++++++++------- 11 files changed, 548 insertions(+), 408 deletions(-) diff --git a/core/videolibrarytools.py b/core/videolibrarytools.py index 1b25cc07..d32083c2 100644 --- a/core/videolibrarytools.py +++ b/core/videolibrarytools.py @@ -111,7 +111,7 @@ def save_movie(item, silent=False): # Si llegados a este punto no tenemos titulo, salimos if not item.contentTitle or not item.channel: logger.debug("contentTitle NOT FOUND") - return 0, 0, -1 # Salimos sin guardar + return 0, 0, -1, path # Salimos sin guardar scraper_return = scraper.find_and_set_infoLabels(item) @@ -123,7 +123,7 @@ def save_movie(item, silent=False): # TODO de momento si no hay resultado no añadimos nada, # aunq podriamos abrir un cuadro para introducir el identificador/nombre a mano logger.debug("NOT FOUND IN SCRAPER OR DO NOT HAVE code") - return 0, 0, -1 + return 0, 0, -1, path _id = item.infoLabels['code'][0] @@ -158,7 +158,7 @@ def save_movie(item, silent=False): logger.info("Creating movie directory:" + path) if not filetools.mkdir(path): logger.debug("Could not create directory") - return 0, 0, -1 + return 0, 0, -1, path nfo_path = filetools.join(path, "%s [%s].nfo" % (base_name, _id)) strm_path = filetools.join(path, "%s.strm" % base_name) @@ -227,14 +227,14 @@ def save_movie(item, silent=False): xbmc_videolibrary.update() if not silent: p_dialog.close() - return insertados, sobreescritos, fallidos + return insertados, sobreescritos, fallidos, path # Si llegamos a este punto es por q algo ha fallado logger.error("Could not save %s in the video library" % item.contentTitle) if not silent: p_dialog.update(100, config.get_localized_string(60063), item.contentTitle) p_dialog.close() - return 0, 0, -1 + return 0, 0, -1, path def update_renumber_options(item, head_nfo, path): from core import jsontools @@ -586,6 +586,22 @@ def save_episodes(path, episodelist, serie, silent=False, overwrite=True): logger.info("There is no episode list, we go out without creating strm") return 0, 0, 0 + # process local episodes + local_episodes_path = '' + nfo_path = filetools.join(path, "tvshow.nfo") + head_nfo, item_nfo = read_nfo(nfo_path) + if item_nfo.update_last: + local_episodes_path = item_nfo.local_episodes_path + elif config.get_setting("local_episodes", "videolibrary"): + done, local_episodes_path = config_local_episodes_path(path, serie.show) + if done < 0: + logger.info("An issue has occurred while configuring local episodes, going out without creating strm") + return 0, 0, done + item_nfo.local_episodes_path = local_episodes_path + filetools.write(nfo_path, head_nfo + item_nfo.tojson()) + if local_episodes_path: + process_local_episodes(local_episodes_path, path) + insertados = 0 sobreescritos = 0 fallidos = 0 @@ -671,9 +687,6 @@ def save_episodes(path, episodelist, serie, silent=False, overwrite=True): except: t = 0 - local_episodelist = get_local_content(path) - - last_season_episode = '' for i, e in enumerate(scraper.sort_episode_list(new_episodelist)): if not silent: p_dialog.update(int(math.ceil((i + 1) * t)), config.get_localized_string(60064), e.title) @@ -695,9 +708,11 @@ def save_episodes(path, episodelist, serie, silent=False, overwrite=True): nfo_path = filetools.join(path, "%s.nfo" % season_episode) json_path = filetools.join(path, ("%s [%s].json" % (season_episode, e.channel)).lower()) - if season_episode in local_episodelist: - logger.info('Skipped: Serie ' + serie.contentSerieName + ' ' + season_episode + ' available as local content') + # check if the episode has been downloaded + if filetools.join(path, "%s [downloads].json" % season_episode) in ficheros: + logger.info('INFO: "%s" episode %s has been downloaded, skipping it' % (serie.contentSerieName, season_episode)) continue + strm_exists = strm_path in ficheros nfo_exists = nfo_path in ficheros json_exists = json_path in ficheros @@ -808,7 +823,8 @@ def save_episodes(path, episodelist, serie, silent=False, overwrite=True): tvshow_item.infoLabels["title"] = tvshow_item.infoLabels["tvshowtitle"] if max_sea == high_sea and max_epi == high_epi and (tvshow_item.infoLabels["status"] == "Ended" - or tvshow_item.infoLabels["status"] == "Canceled") and insertados == 0 and fallidos == 0: + or tvshow_item.infoLabels["status"] == "Canceled") and insertados == 0 and fallidos == 0 \ + and not tvshow_item.local_episodes_path: tvshow_item.active = 0 # ... no la actualizaremos más logger.debug("%s [%s]: serie 'Terminada' o 'Cancelada'. Se desactiva la actualización periódica" % \ (serie.contentSerieName, serie.channel)) @@ -838,19 +854,62 @@ def save_episodes(path, episodelist, serie, silent=False, overwrite=True): return insertados, sobreescritos, fallidos -def get_local_content(path): +def config_local_episodes_path(path, title): logger.info() - local_episodelist = [] - for root, folders, files in filetools.walk(path): + local_episodes_path = '' + if platformtools.dialog_yesno(config.get_localized_string(30131), config.get_localized_string(80044) % title): + if config.is_xbmc() and not config.get_setting("videolibrary_kodi"): + platformtools.dialog_ok(config.get_localized_string(30131), config.get_localized_string(80043)) + local_episodes_path = platformtools.dialog_browse(0, config.get_localized_string(80046)) + if local_episodes_path == '': + logger.info("User has canceled the dialog") + return -2, local_episodes_path + elif path in local_episodes_path: + platformtools.dialog_ok(config.get_localized_string(30131), config.get_localized_string(80045)) + logger.info("Selected folder is the same of the TV show one") + return -2, local_episodes_path + + if local_episodes_path: + # import artwork + files = filetools.listdir(local_episodes_path) + for file in files: + if file.endswith('.jpg') or file.endswith('.jpeg') or file.endswith('.png'): + filetools.copy(filetools.join(local_episodes_path, file), filetools.join(path, file)) + + return 0, local_episodes_path + + +def process_local_episodes(local_episodes_path, path): + logger.info() + + local_episodes_list = [] + for root, folders, files in filetools.walk(local_episodes_path): for file in files: season_episode = scrapertools.get_season_and_episode(file) - if season_episode == "" or filetools.exists(filetools.join(path, "%s.strm" % season_episode)): + if season_episode == "": continue - local_episodelist.append(season_episode) - local_episodelist = sorted(set(local_episodelist)) + local_episodes_list.append(season_episode) - return local_episodelist + local_episodes_list = sorted(set(local_episodes_list)) + + nfo_path = filetools.join(path, "tvshow.nfo") + head_nfo, item_nfo = read_nfo(nfo_path) + + # if a local episode has been added, overwrites the strm + for season_episode in set(local_episodes_list).difference(item_nfo.local_episodes_list): + filetools.write(filetools.join(path, season_episode + '.strm'), filetools.join(root, file)) + + # if a local episode has been removed, deletes the strm + for season_episode in set(item_nfo.local_episodes_list).difference(local_episodes_list): + filetools.remove(filetools.join(path, season_episode + '.strm')) + + # updates the local episodes path and list in the nfo + if not local_episodes_list: + item_nfo.local_episodes_path = '' + item_nfo.local_episodes_list = local_episodes_list + + filetools.write(nfo_path, head_nfo + item_nfo.tojson()) def add_movie(item): @@ -883,12 +942,13 @@ def add_movie(item): # del item.tmdb_stat #Limpiamos el status para que no se grabe en la Videoteca new_item = item.clone(action="findvideos") - insertados, sobreescritos, fallidos = save_movie(new_item) + 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) # 'se ha añadido a la videoteca' else: + filetools.rmdirtree(path) platformtools.dialog_ok(config.get_localized_string(30131), config.get_localized_string(60066) % new_item.contentTitle) #"ERROR, la pelicula NO se ha añadido a la videoteca") @@ -968,13 +1028,18 @@ def add_tvshow(item, channel=None): insertados, sobreescritos, fallidos, path = save_tvshow(item, itemlist) if not insertados and not sobreescritos and not fallidos: + filetools.rmdirtree(path) platformtools.dialog_ok(config.get_localized_string(30131), config.get_localized_string(60067) % item.show) logger.error("La serie %s no se ha podido añadir a la videoteca. No se ha podido obtener ningun episodio" % item.show) elif fallidos == -1: + filetools.rmdirtree(path) platformtools.dialog_ok(config.get_localized_string(30131), config.get_localized_string(60068) % item.show) logger.error("La serie %s no se ha podido añadir a la videoteca" % item.show) + elif fallidos == -2: + filetools.rmdirtree(path) + elif fallidos > 0: platformtools.dialog_ok(config.get_localized_string(30131), config.get_localized_string(60069) % item.show) logger.error("No se han podido añadir %s episodios de la serie %s a la videoteca" % (fallidos, item.show)) diff --git a/platformcode/config.py b/platformcode/config.py index cf34f97a..707261fe 100644 --- a/platformcode/config.py +++ b/platformcode/config.py @@ -211,9 +211,7 @@ def open_settings(): if not settings_pre.get("videolibrary_kodi", None) and settings_post.get("videolibrary_kodi", None): xbmc_videolibrary.ask_set_content(silent=True) elif settings_pre.get("videolibrary_kodi", None) and not settings_post.get("videolibrary_kodi", None): - strm_list = [] - strm_list.append(get_setting('videolibrarypath')) - xbmc_videolibrary.clean(strm_list) + xbmc_videolibrary.clean() def get_setting(name, channel="", server="", default=None): diff --git a/platformcode/xbmc_videolibrary.py b/platformcode/xbmc_videolibrary.py index baecce5c..86b2ed4a 100644 --- a/platformcode/xbmc_videolibrary.py +++ b/platformcode/xbmc_videolibrary.py @@ -13,6 +13,7 @@ import os import threading import time import re +import math import xbmc from core import filetools @@ -503,7 +504,7 @@ def update(folder_content=config.get_setting("folder_tvshows"), folder=""): #update_path = filetools.join(videolibrarypath, folder_content, folder) + "/" # Problemas de encode en "folder" update_path = filetools.join(videolibrarypath, folder_content, ' ').rstrip() - if not scrapertools.find_single_match(update_path, '(^\w+:\/\/)'): + if videolibrarypath.startswith("special:") or not scrapertools.find_single_match(update_path, '(^\w+:\/\/)'): payload["params"] = {"directory": update_path} while xbmc.getCondVisibility('Library.IsScanningVideo()'): @@ -511,8 +512,6 @@ def update(folder_content=config.get_setting("folder_tvshows"), folder=""): data = get_data(payload) - #xbmc.executebuiltin('XBMC.ReloadSkin()') - def search_library_path(): sql = 'SELECT strPath FROM path WHERE strPath LIKE "special://%/plugin.video.kod/library/" AND idParentPath ISNULL' @@ -896,127 +895,76 @@ def clean(path_list=[]): progress = platformtools.dialog_progress_bg(config.get_localized_string(20000), config.get_localized_string(80025)) progress.update(0) - for path in path_list: - - idParentPath = 0 - sql_path = '' - sql_movies_path = '' - sql_tvshows_path = '' - sql_episodes_path = '' - - path, sep = sql_format(path) - movies_folder = config.get_setting("folder_movies") - tvshows_folder = config.get_setting("folder_tvshows") - - # delete episode/movie (downloads.py move_to_libray) - if path.endswith(".strm"): - if movies_folder in path: - sql_movies_path = path - else: - sql_episodes_path = path - # delete movie - elif movies_folder in path: - if not path.endswith(sep): path += sep - - sql_movies_path = path + '%' - # delete tvshow - elif tvshows_folder in path: - if not path.endswith(sep): path += sep - - sql_tvshows_path = path + '%' - - sql_episodes_path = sql_tvshows_path - # delete video library - else: - if not path.endswith(sep): path += sep - - sql_path = path - - sql_movies_path = sql_path + movies_folder - if not sql_movies_path.endswith(sep): sql_movies_path += sep - sql_movies_path += '%' - - sql_tvshows_path = sql_path + tvshows_folder - if not sql_tvshows_path.endswith(sep): sql_tvshows_path += sep - sql_tvshows_path += '%' - - sql_episodes_path = sql_tvshows_path - - if sql_path: - # search video library path in the DB + # if the path list is empty, clean the entire video library + if not path_list: + if not config.get_setting("videolibrary_kodi"): + sql_path, sep = sql_format(config.get_setting("videolibrarypath")) + if not sql_path.endswith(sep): sql_path += sep sql = 'SELECT idPath FROM path where strPath LIKE "%s"' % sql_path nun_records, records = execute_sql_kodi(sql) - # delete video library path - if records: - idPath = records[0][0] - idParentPath = idPath - if not config.get_setting("videolibrary_kodi"): - sql = 'DELETE from path WHERE idPath=%s' % idPath - nun_records, records = execute_sql_kodi(sql) - - if sql_movies_path: - # search movies in the DB - sql = 'SELECT idMovie FROM movie where c22 LIKE "%s"' % sql_movies_path + idPath = records[0][0] + sql = 'DELETE from path WHERE idPath=%s' % idPath nun_records, records = execute_sql_kodi(sql) - # delete movies - if records: - for record in records: - idMovie = record[0] - sql = 'DELETE from movie WHERE idMovie=%s' % idMovie - nun_records, records = execute_sql_kodi(sql) - - if sql_movies_path: - # search movies path and folders in the DB - sql = 'SELECT idPath, idParentPath FROM path where strPath LIKE "%s"' % sql_movies_path + sql = 'DELETE from path WHERE idParentPath=%s' % idPath nun_records, records = execute_sql_kodi(sql) - # delete movies path and folders - if records: - for record in records: - if record[1] == idParentPath and config.get_setting("videolibrary_kodi"): - continue - idPath = record[0] - sql = 'DELETE from path WHERE idPath=%s' % idPath - nun_records, records = execute_sql_kodi(sql) - if sql_tvshows_path: - # search TV shows in the DB - sql = 'SELECT idShow FROM tvshow_view where strPath LIKE "%s"' % sql_tvshows_path - nun_records, records = execute_sql_kodi(sql) - # delete TV shows - if records: - for record in records: - idShow = record[0] - sql = 'DELETE from tvshow WHERE idShow=%s' % idShow - nun_records, records = execute_sql_kodi(sql) + from core import videolibrarytools + for path, folders, files in filetools.walk(videolibrarytools.MOVIES_PATH): + for folder in folders: + path_list.append(filetools.join(config.get_setting("videolibrarypath"), videolibrarytools.FOLDER_MOVIES, folder)) - if sql_episodes_path: - # search episodes in the DB - sql = 'SELECT idEpisode FROM episode where c18 LIKE "%s"' % sql_episodes_path - nun_records, records = execute_sql_kodi(sql) - # delete episodes - if records: - for record in records: - idEpisode = record[0] - sql = 'DELETE from episode WHERE idEpisode=%s' % idEpisode - nun_records, records = execute_sql_kodi(sql) + for path, folders, files in filetools.walk(videolibrarytools.TVSHOWS_PATH): + for folder in folders: + tvshow_nfo = filetools.join(path, folder, "tvshow.nfo") + if filetools.exists(tvshow_nfo): + path_list.append(filetools.join(config.get_setting("videolibrarypath"), videolibrarytools.FOLDER_TVSHOWS, folder)) - if sql_tvshows_path: - # search TV shows path and folders in the DB - sql = 'SELECT idPath, idParentPath FROM path where strPath LIKE "%s"' % sql_tvshows_path + if path_list: t = float(100) / len(path_list) + for i, path in enumerate(path_list): + progress.update(int(math.ceil((i + 1) * t))) + + if not path: + continue + + sql_path, sep = sql_format(path) + if filetools.isdir(path) and not sql_path.endswith(sep): sql_path += sep + + if filetools.isdir(path): + # search movie in the DB + sql = 'SELECT idMovie FROM movie where c22 LIKE "%s"' % (sql_path + '%') nun_records, records = execute_sql_kodi(sql) - # delete tvshows path and folders + # delete movie if records: - for record in records: - if record[1] == idParentPath and config.get_setting("videolibrary_kodi"): - continue - idPath = record[0] - sql = 'DELETE from path WHERE idPath=%s' % idPath - nun_records, records = execute_sql_kodi(sql) + payload = {"jsonrpc": "2.0", "method": "VideoLibrary.RemoveMovie", "id": 1, "params": {"movieid": records[0][0]}} + data = get_data(payload) + continue + # search TV show in the DB + sql = 'SELECT idShow FROM tvshow_view where strPath LIKE "%s"' % sql_path + nun_records, records = execute_sql_kodi(sql) + # delete TV show + if records: + payload = {"jsonrpc": "2.0", "method": "VideoLibrary.RemoveTVShow", "id": 1, "params": {"tvshowid": records[0][0]}} + data = get_data(payload) + elif config.get_setting("folder_movies") in sql_path: + # search movie in the DB + sql = 'SELECT idMovie FROM movie where c22 LIKE "%s"' % sql_path + nun_records, records = execute_sql_kodi(sql) + # delete movie + if records: + payload = {"jsonrpc": "2.0", "method": "VideoLibrary.RemoveMovie", "id": 1, "params": {"movieid": records[0][0]}} + data = get_data(payload) + else: + # search episode in the DB + sql = 'SELECT idEpisode FROM episode where c18 LIKE "%s"' % sql_path + nun_records, records = execute_sql_kodi(sql) + # delete episode + if records: + payload = {"jsonrpc": "2.0", "method": "VideoLibrary.RemoveEpisode", "id": 1, "params": {"episodeid": records[0][0]}} + data = get_data(payload) progress.update(100) xbmc.sleep(1000) progress.close() - xbmc.executebuiltin('XBMC.ReloadSkin()') def execute_sql_kodi(sql): @@ -1120,7 +1068,6 @@ def check_sources(new_movies_path='', new_tvshows_path=''): return False, False - def update_sources(new='', old=''): logger.info() if new == old: return @@ -1212,6 +1159,8 @@ def ask_set_content(silent=False): if set_content("movie", True, custom) and set_content("tvshow", True, custom): platformtools.dialog_ok(config.get_localized_string(80026), config.get_localized_string(70104)) config.set_setting("videolibrary_kodi", True) + from specials import videolibrary + videolibrary.update_videolibrary() update() else: platformtools.dialog_ok(config.get_localized_string(80026), config.get_localized_string(80024)) diff --git a/resources/language/English/strings.po b/resources/language/English/strings.po index 054bdee4..028ef826 100644 --- a/resources/language/English/strings.po +++ b/resources/language/English/strings.po @@ -28,7 +28,7 @@ msgid "Check for updates" msgstr "" msgctxt "#30002" -msgid "Touch optmized view" +msgid "Touch optimized view" msgstr "" msgctxt "#30003" @@ -108,7 +108,7 @@ msgid "Contextual menu" msgstr "" msgctxt "#30025" -msgid "Show KoD settings" +msgid "" msgstr "" msgctxt "#30026" @@ -477,15 +477,15 @@ msgid "Academy Awards" msgstr "" msgctxt "#30998" -msgid "Shortcut" +msgid "Quick menu shortcut" msgstr "" msgctxt "#30999" -msgid "Assign key to open shortcut" +msgid "Assign key" msgstr "" msgctxt "#31000" -msgid "Remove key to open shortcut" +msgid "Unassign key" msgstr "" msgctxt "#50000" @@ -709,11 +709,11 @@ msgid "Mark TV show as watched" msgstr "" msgctxt "#60022" -msgid "Automatically find new episodes: Disable" +msgid "Remove from video library update" msgstr "" msgctxt "#60023" -msgid "Automatically find new episodes: Enable" +msgid "Add to video library update" msgstr "" msgctxt "#60024" @@ -725,7 +725,7 @@ msgid "Delete TV show" msgstr "" msgctxt "#60026" -msgid "Search for new episodes and update" +msgid "KoD settings" msgstr "" msgctxt "#60027" @@ -789,7 +789,7 @@ msgid "Delete TV show" msgstr "" msgctxt "#60042" -msgid "Delete links of %s" +msgid "Delete channel %s" msgstr "" msgctxt "#60043" @@ -797,7 +797,7 @@ msgid "Delete %s links of channel %s" msgstr "" msgctxt "#60044" -msgid "Do you want really to delete '%s' from video library?" +msgid "Do you want really to delete "%s" from video library?" msgstr "" msgctxt "#60045" @@ -877,7 +877,7 @@ msgid "Added episode to the video library..." msgstr "" msgctxt "#60066" -msgid "An error has occurred. It has not been possible to add the movie "%s" to the video library" +msgid "An error has occurred. The movie "%s" has not been added to the video library" msgstr "" msgctxt "#60067" @@ -889,7 +889,7 @@ msgid "An error has occurred. The TV show "%s" has not been added to the video l msgstr "" msgctxt "#60069" -msgid "An error has occurred. The TV show "%s" has not been added completely to the video library" +msgid "An error has occurred. The TV show "%s" has not been completely added to the video library" msgstr "" msgctxt "#60070" @@ -897,7 +897,7 @@ msgid "The TV show "%s" has been added to the video library" msgstr "" msgctxt "#60071" -msgid "Autoplay configuration" +msgid "AutoPlay configuration" msgstr "" msgctxt "#60072" @@ -1557,7 +1557,7 @@ msgid "Information" msgstr "" msgctxt "#60349" -msgid "Go to the main menu" +msgid "Previous menu" msgstr "" msgctxt "#60350" @@ -1565,7 +1565,7 @@ msgid "Search in other channels" msgstr "Search in other channels" msgctxt "#60351" -msgid "Set as Homepage" +msgid "Set as main menu" msgstr "" msgctxt "#60352" @@ -1681,7 +1681,7 @@ msgid "Summary:" msgstr "" msgctxt "#60389" -msgid "Updating %s [%s]..." +msgid "Updating "%s" [%s]..." msgstr "" msgctxt "#60390" @@ -2293,7 +2293,7 @@ msgid "Download settings" msgstr "" msgctxt "#60542" -msgid "Video library settings" +msgid "Configure video library" msgstr "" msgctxt "#60544" @@ -2385,7 +2385,7 @@ msgid "Restore video library (strm, nfo and json)" msgstr "" msgctxt "#60568" -msgid "Search for new episodes and update video library" +msgid "Update video library" msgstr "" msgctxt "#60569" @@ -2489,7 +2489,7 @@ msgid " Server #%s" msgstr "" msgctxt "#60598" -msgid "Configuration of video library" +msgid "Video library configuration" msgstr "" msgctxt "#60600" @@ -2509,15 +2509,15 @@ msgid "When Kodi starts" msgstr "" msgctxt "#60604" -msgid "Once a day" +msgid "Daily" msgstr "" msgctxt "#60605" -msgid "At the start of Kodi and once a day" +msgid "When Kodi starts and daily" msgstr "" msgctxt "#60606" -msgid " Wait before updating at startup of Kodi" +msgid " Update waiting time" msgstr "" msgctxt "#60607" @@ -2541,11 +2541,11 @@ msgid "60 sec" msgstr "" msgctxt "#60613" -msgid " Begin scheduled update from" +msgid " Update time" msgstr "" msgctxt "#60614" -msgid " Search for new episodes in active TV shows" +msgid " Search for new episodes" msgstr "" msgctxt "#60615" @@ -2557,15 +2557,15 @@ msgid "Always" msgstr "" msgctxt "#60617" -msgid "According to new episodes" +msgid "Based on airing" msgstr "" msgctxt "#60618" -msgid " Search for content in" +msgid " Kodi video library update" msgstr "" msgctxt "#60619" -msgid "The folder of each TV show" +msgid "Each TV show" msgstr "" msgctxt "#60620" @@ -2573,7 +2573,7 @@ msgid "All video library" msgstr "" msgctxt "#60621" -msgid "Show links in" +msgid "Links view" msgstr "" msgctxt "#60622" @@ -2629,7 +2629,7 @@ msgid "0 seg" msgstr "" msgctxt "#60637" -msgid "Synchronizing with Trakt" +msgid " Synchronizing with Trakt" msgstr "" msgctxt "#60638" @@ -2673,7 +2673,7 @@ msgid "Never" msgstr "" msgctxt "#60650" -msgid "Video library information provider" +msgid " Video library information providers" msgstr "" msgctxt "#60651" @@ -3117,15 +3117,15 @@ msgid "Most Viewed" msgstr "" msgctxt "#70078" -msgid "Show only links of " +msgid "Show links of " msgstr "" msgctxt "#70079" -msgid "Delete ony the links of " +msgid "Delete channel " msgstr "" msgctxt "#70081" -msgid "The folder also contains local or downloaded video files. Do you want to delete them?" +msgid "The folder "%s" contains other files. Delete it anyway?" msgstr "" msgctxt "#70082" @@ -3145,7 +3145,7 @@ msgid "Delete TV show" msgstr "" msgctxt "#70086" -msgid "Delete only the links of %s" +msgid "Delete channel %s" msgstr "" msgctxt "#70087" @@ -3153,7 +3153,7 @@ msgid "Deleted %s links from canal %s" msgstr "" msgctxt "#70088" -msgid "Are you sure you want to delete '%s' from video library?" +msgid "Are you sure you want to delete "%s" from video library?" msgstr "" msgctxt "#70089" @@ -3305,8 +3305,8 @@ msgid "Customization" msgstr "" msgctxt "#70128" -msgid "Infoplus Animation" -msgstr "Animazione Infoplus" +msgid "InfoPlus animation" +msgstr "Animazione InfoPlus" msgctxt "#70129" msgid "Without animation" @@ -3397,7 +3397,7 @@ msgid "Contextual menu" msgstr "" msgctxt "#70151" -msgid "Show Infoplus" +msgid "Show InfoPlus" msgstr "" msgctxt "#70152" @@ -3405,7 +3405,7 @@ msgid "Show ExtendedInfo" msgstr "" msgctxt "#70153" -msgid "Shortcut" +msgid "" msgstr "" msgctxt "#70154" @@ -3853,11 +3853,15 @@ msgid "The data entered is not correct!" msgstr "" msgctxt "#70266" -msgid "The search for% s did not match." +msgid "The search for %s did not match" +msgstr "" + +msgctxt "#70268" +msgid "The TV show "%s" is ended or has been canceled. Would you like to remove it from the video library update?" msgstr "" msgctxt "#70269" -msgid "Search new episodes now" +msgid "Search new episodes" msgstr "" msgctxt "#70270" @@ -3929,7 +3933,7 @@ msgid "Configure search" msgstr "" msgctxt "#70287" -msgid "Configure video library" +msgid "Video library settings" msgstr "" msgctxt "#70288" @@ -5905,7 +5909,7 @@ msgstr "" msgctxt "#70784" msgid "Attention!" -msgstr "Attenzione!" +msgstr "" msgctxt "#70785" msgid "Install Elementum" @@ -6290,4 +6294,36 @@ msgstr "" msgctxt "#80041" msgid "Latest updates:\n" +msgstr "" + +msgctxt "#80042" +msgid "Include local episodes when adding a TV shows" +msgstr "" + +msgctxt "#80043" +msgid "Attention, in order to watch local episodes you have to configure the Kodi video library from the settings menu inside KoD" +msgstr "" + +msgctxt "#80044" +msgid "Do you want to include local episodes for the TV show "%s"?" +msgstr "" + +msgctxt "#80045" +msgid "The folder of the local episodes has to be different from the TV show one in the KoD video library" +msgstr "" + +msgctxt "#80046" +msgid "Select the folder containing the local episodes" +msgstr "" + +msgctxt "#80047" +msgid "The TV show "% s" includes local episodes. They will be only removed from the Kodi video library without being deleted" +msgstr "" + +msgctxt "#80048" +msgid "Add local episodes" +msgstr "" + +msgctxt "#80049" +msgid "Remove local episodes" msgstr "" \ No newline at end of file diff --git a/resources/language/Italian/strings.po b/resources/language/Italian/strings.po index 7a48375b..bbbd3ad2 100644 --- a/resources/language/Italian/strings.po +++ b/resources/language/Italian/strings.po @@ -28,8 +28,8 @@ msgid "Check for updates" msgstr "Verifica aggiornamenti" msgctxt "#30002" -msgid "Touch optmized view" -msgstr "Vista ottimizzata per i dispositivi touch" +msgid "Touch optimized view" +msgstr "Vista ottimizzata touch" msgctxt "#30003" msgid "Enable debug logging" @@ -108,8 +108,8 @@ msgid "Contextual menu" msgstr "Menu contestuale" msgctxt "#30025" -msgid "Show KoD settings" -msgstr "Mostra impostazioni KoD" +msgid "" +msgstr "" msgctxt "#30026" msgid "Direct" @@ -476,16 +476,16 @@ msgid "Academy Awards" msgstr "Premi Oscar" msgctxt "#30998" -msgid "Shortcut" -msgstr "Scorciatoia" +msgid "Quick menu shortcut" +msgstr "Scorciatoia menu rapido" msgctxt "#30999" -msgid "Assign key to open shortcut" -msgstr "Assegna tasto scorciatoia" +msgid "Assign key" +msgstr "Assegna tasto" msgctxt "#31000" -msgid "Remove key to open shortcut" -msgstr "Rimuovi tasto scorciatoia" +msgid "Unassign key" +msgstr "Disassegna tasto" msgctxt "#50000" msgid "Sagas" @@ -708,12 +708,12 @@ msgid "Mark TV show as watched" msgstr "Segna serie TV come vista" msgctxt "#60022" -msgid "Automatically find new episodes: Disable" -msgstr "Trova automaticamente nuovi episodi: Disattiva" +msgid "Remove from video library update" +msgstr "Rimuovi da aggiornamento videoteca" msgctxt "#60023" -msgid "Automatically find new episodes: Enable" -msgstr "Trova automaticamente nuovi episodi: Attiva" +msgid "Add to video library update" +msgstr "Aggiungi ad aggiornamento videoteca" msgctxt "#60024" msgid "Delete TV show/channel" @@ -724,8 +724,8 @@ msgid "Delete TV show" msgstr "Elimina serie TV" msgctxt "#60026" -msgid "Search for new episodes and update" -msgstr "Cerca nuovi episodi e aggiorna" +msgid "KoD settings" +msgstr "Impostazioni KoD" msgctxt "#60027" msgid "Season %s" @@ -788,16 +788,16 @@ msgid "Delete TV show" msgstr "Elimina serie TV" msgctxt "#60042" -msgid "Delete links of %s" -msgstr "Elimina link di %s" +msgid "Delete channel %s" +msgstr "Elimina canale %s" msgctxt "#60043" msgid "Delete %s links of channel %s" msgstr "Cancellati %s collegamenti del canale %s" msgctxt "#60044" -msgid "Do you want really to delete '%s' from video library?" -msgstr "Vuoi davvero rimuovere '%s' dalla videoteca?" +msgid "Do you want really to delete "%s" from video library?" +msgstr "Vuoi davvero rimuovere "%s" dalla videoteca?" msgctxt "#60045" msgid "Sync with Trakt started" @@ -876,8 +876,8 @@ msgid "Added episode to the video library..." msgstr "Aggiunta episodio alla videoteca..." msgctxt "#60066" -msgid "An error has occurred. It has not been possible to add the movie "%s" to the video library" -msgstr "Si è verificato un errore. Non è stato possibile aggiungere il film "%s" alla videoteca" +msgid "An error has occurred. The movie "%s" has not been added to the video library" +msgstr "Si è verificato un errore. Il film "%s" non è stato aggiunto alla videoteca" msgctxt "#60067" msgid "An error has occurred. The TV show "%s" has not been added to the video library. It has not been possible to add any episode" @@ -888,7 +888,7 @@ msgid "An error has occurred. The TV show "%s" has not been added to the video l msgstr "Si è verificato un errore. La serie TV "%s" non è stata aggiunta alla videoteca" msgctxt "#60069" -msgid "An error has occurred. The TV show "%s" has not been added completely to the video library" +msgid "An error has occurred. The TV show "%s" has not been completely added to the video library" msgstr "Si è verificato un errore. La serie TV "%s" non è stata aggiunta completamente alla videoteca" msgctxt "#60070" @@ -896,7 +896,7 @@ msgid "The TV show "%s" has been added to the video library" msgstr "La serie TV "%s" è stata aggiunta alla videoteca" msgctxt "#60071" -msgid "Autoplay configuration" +msgid "AutoPlay configuration" msgstr "Configurazione Autoplay" msgctxt "#60072" @@ -1556,16 +1556,16 @@ msgid "Information" msgstr "Informazione" msgctxt "#60349" -msgid "Go to the main menu" -msgstr "Andare al menu principale" +msgid "Previous menu" +msgstr "Menu precedente" msgctxt "#60350" msgid "Search in other channels" msgstr "Cerca negli altri canali" msgctxt "#60351" -msgid "Set as Homepage" -msgstr "Impostare come Homepage" +msgid "Set as main menu" +msgstr "Imposta come menu principale" msgctxt "#60352" msgid "Add TV show to video library" @@ -1680,8 +1680,8 @@ msgid "Summary:" msgstr "Riassunto:" msgctxt "#60389" -msgid "Updating %s [%s]..." -msgstr "Aggiornamento %s [%s]..." +msgid "Updating "%s" [%s]..." +msgstr "Aggiornamento "%s" [%s]..." msgctxt "#60390" msgid "AutoPlay configuration" @@ -2292,8 +2292,8 @@ msgid "Download settings" msgstr "Impostazioni download" msgctxt "#60542" -msgid "Video library settings" -msgstr "Impostazioni videoteca" +msgid "Configure video library" +msgstr "Configura videoteca" msgctxt "#60544" msgid "More Options" @@ -2384,8 +2384,8 @@ msgid "Restore video library (strm, nfo and json)" msgstr "Ripristina videoteca (strm, nfo e json)" msgctxt "#60568" -msgid "Search for new episodes and update video library" -msgstr "Cerca nuovi episodi ed aggiorna videoteca" +msgid "Update video library" +msgstr "Aggiorna videoteca" msgctxt "#60569" msgid " - There are no default settings" @@ -2420,7 +2420,7 @@ msgid "A saving error occurred" msgstr "Si è verificato un errore al salvataggio" msgctxt "#60581" -msgid "Restoring the video library" +msgid "Restoring video library" msgstr "Ripristino videoteca" msgctxt "#60582" @@ -2488,8 +2488,8 @@ msgid " Server #%s" msgstr " Server #%s" msgctxt "#60598" -msgid "Configuration of video library" -msgstr "Configurazione della videoteca" +msgid "Video library configuration" +msgstr "Configurazione videoteca" msgctxt "#60600" msgid "TV shows" @@ -2508,16 +2508,16 @@ msgid "When Kodi starts" msgstr "All'avvio di Kodi" msgctxt "#60604" -msgid "Once a day" -msgstr "Una volta al giorno" +msgid "Daily" +msgstr "Giornaliero" msgctxt "#60605" -msgid "At the start of Kodi and once a day" -msgstr "All'avvio di Kodi e una volta al giorno" +msgid "When Kodi starts and daily" +msgstr "All'avvio di Kodi e giornaliero" msgctxt "#60606" -msgid " Wait before updating at startup of Kodi" -msgstr " Attendere prima di aggiornare all'avvio di Kodi" +msgid " Update waiting time" +msgstr " Tempo di attesa aggiornamento" msgctxt "#60607" msgid "When Kodi starts" @@ -2540,12 +2540,12 @@ msgid "60 sec" msgstr "60 sec" msgctxt "#60613" -msgid " Begin scheduled update from" -msgstr " Inizia aggiornamento programmato a partire dalle" +msgid " Update time" +msgstr " Ora aggiornamento" msgctxt "#60614" -msgid " Search for new episodes in active TV shows" -msgstr " Cerca nuovi episodi nelle serie TV attive" +msgid " Search for new episodes" +msgstr " Cerca nuovi episodi" msgctxt "#60615" msgid "Never" @@ -2556,24 +2556,24 @@ msgid "Always" msgstr "Sempre" msgctxt "#60617" -msgid "According to new episodes" -msgstr "Secondo le uscite" +msgid "Based on airing" +msgstr "In base all'uscita" msgctxt "#60618" -msgid " Search for content in" -msgstr " Esegui ricerca dei contenuti in" +msgid " Kodi video library update" +msgstr " Aggiornamento libreria di Kodi" msgctxt "#60619" -msgid "The folder of each TV show" -msgstr "La cartella di ogni serie TV" +msgid "Each TV show" +msgstr "Per serie TV" msgctxt "#60620" msgid "All video library" msgstr "Tutta la videoteca" msgctxt "#60621" -msgid "Show links in" -msgstr "Mostra collegamenti in" +msgid "Links view" +msgstr "Visualizzazione collegamenti" msgctxt "#60622" msgid "Normal window" @@ -2628,8 +2628,8 @@ msgid "0 seg" msgstr "0 sec" msgctxt "#60637" -msgid "Synchronizing with Trakt" -msgstr "Sincronizzazione con Trakt" +msgid " Synchronizing with Trakt" +msgstr " Sincronizzazione con Trakt" msgctxt "#60638" msgid " After mark as watched the episode" @@ -2672,8 +2672,8 @@ msgid "Never" msgstr "Mai" msgctxt "#60650" -msgid "Video library information provider" -msgstr "Provider informazioni videoteca" +msgid " Video library information providers" +msgstr " Provider informazioni videoteca" msgctxt "#60651" msgid " Movies" @@ -2817,11 +2817,11 @@ msgstr "OK" msgctxt "#70002" msgid "Cancel" -msgstr "Annullare" +msgstr "Annulla" msgctxt "#70003" msgid "Default" -msgstr "Default" +msgstr "Predefinito" msgctxt "#70004" msgid "Loading..." @@ -3116,16 +3116,16 @@ msgid "Most Viewed" msgstr "Più Viste" msgctxt "#70078" -msgid "Show only links of " -msgstr "Mostra solo link di " +msgid "Show links of " +msgstr "Mostra link di " msgctxt "#70079" -msgid "Delete only the links of " -msgstr "Elimina solo i link di " +msgid "Delete channel " +msgstr "Elimina canale " msgctxt "#70081" -msgid "The folder also contains local or downloaded video files. Do you want to delete them?" -msgstr "La cartella contiene anche file video locali o scaricati. Vuoi eliminarli?" +msgid "The folder "%s" contains other files. Delete it anyway?" +msgstr "La cartella "%s" contiene altri file. Eliminarla comunque?" msgctxt "#70082" msgid "Global Search" @@ -3144,16 +3144,16 @@ msgid "Delete TV show" msgstr "Elimina serie TV" msgctxt "#70086" -msgid "Delete only the links of %s" -msgstr "Elimina solo i link di %s" +msgid "Delete channel %s" +msgstr "Elimina canale %s" msgctxt "#70087" msgid "Deleted %s links from canal %s" msgstr "Eliminati %s link del canale %s" msgctxt "#70088" -msgid "Are you sure you want to delete '%s' from video library?" -msgstr "Vuoi davvero eliminare '%s' dalla videoteca?" +msgid "Are you sure you want to delete "%s" from video library?" +msgstr "Vuoi davvero eliminare "%s" dalla videoteca?" msgctxt "#70089" msgid "Show only links of %s" @@ -3304,8 +3304,8 @@ msgid "Customization" msgstr "Personalizzazione" msgctxt "#70128" -msgid "Infoplus Animation" -msgstr "Animazione Infoplus" +msgid "InfoPlus animation" +msgstr "Animazione InfoPlus" msgctxt "#70129" msgid "Without animation" @@ -3396,16 +3396,16 @@ msgid "Contextual menu" msgstr "Menu contestuale" msgctxt "#70151" -msgid "Show Infoplus" -msgstr "Mostra Infoplus" +msgid "Show InfoPlus" +msgstr "Mostra InfoPlus" msgctxt "#70152" msgid "Show ExtendedInfo" msgstr "Mostra ExtendedInfo" msgctxt "#70153" -msgid "Shortcut" -msgstr "Scorciatoia" +msgid "" +msgstr "" msgctxt "#70154" msgid "TMDB search" @@ -3852,12 +3852,16 @@ msgid "The data entered is not correct!" msgstr "I dati introdotti non sono corretti!" msgctxt "#70266" -msgid "The search for% s did not match." -msgstr "La ricerca di %s non ha dato risultati." +msgid "The search for %s did not match" +msgstr "La ricerca di %s non ha dato risultati" + +msgctxt "#70268" +msgid "The TV show "%s" is ended or has been canceled. Would you like to remove it from the video library update?" +msgstr "La serie TV "%s" è terminata o è stata cancellata. Vuoi rimuoverla dall'aggiornamento della videoteca?" msgctxt "#70269" -msgid "Search new episodes now" -msgstr "Cerca nuovi episodi adesso" +msgid "Search new episodes" +msgstr "Cerca nuovi episodi" msgctxt "#70270" msgid "Movies video library" @@ -3928,8 +3932,8 @@ msgid "Configure search" msgstr "Configura ricerca" msgctxt "#70287" -msgid "Configure video library" -msgstr "Configura videoteca" +msgid "Video library settings" +msgstr "Impostazioni videoteca" msgctxt "#70288" msgid "Configure downloads" @@ -6290,4 +6294,36 @@ msgstr "Add-on aggiornato al commit %s" msgctxt "#80041" msgid "Latest updates:\n" -msgstr "Ultimi aggiornamenti:\n" \ No newline at end of file +msgstr "Ultimi aggiornamenti:\n" + +msgctxt "#80042" +msgid "Include local episodes when adding a TV shows" +msgstr "Includere episodi in locale all'aggiunta di una serie TV" + +msgctxt "#80043" +msgid "Attention, in order to watch local episodes you have to configure the Kodi video library from the settings menu inside KoD" +msgstr "Attenzione, per guardare gli episodi in locale devi configurare la libreria di Kodi dal menu impostazioni all'interno di KoD" + +msgctxt "#80044" +msgid "Do you want to include local episodes for the TV show "%s"?" +msgstr "Vuoi includere degli episodi in locale per la serie TV "%s"?" + +msgctxt "#80045" +msgid "The folder of the local episodes has to be different from the TV show one in the KoD video library" +msgstr "La cartella degli episodi in locale deve essere diversa da quella della serie TV nella videoteca di KoD" + +msgctxt "#80046" +msgid "Select the folder containing the local episodes" +msgstr "Seleziona la cartella contenente gli episodi in locale" + +msgctxt "#80047" +msgid "The TV show "% s" includes local episodes. They will be only removed from the Kodi video library without being deleted" +msgstr "La serie TV "%s" include degli episodi in locale. Verranno solo rimossi dalla libreria di Kodi senza essere cancellati" + +msgctxt "#80048" +msgid "Add local episodes" +msgstr "Aggiungi episodi in locale" + +msgctxt "#80049" +msgid "Remove local episodes" +msgstr "Rimuovi episodi in locale" \ No newline at end of file diff --git a/resources/settings.xml b/resources/settings.xml index e41734f2..5603e8ce 100644 --- a/resources/settings.xml +++ b/resources/settings.xml @@ -6,8 +6,8 @@ - - + + @@ -42,11 +42,11 @@ + - @@ -130,8 +130,8 @@ - - + + @@ -145,12 +145,12 @@ - + - + diff --git a/specials/backup.py b/specials/backup.py index d46b4a1e..5802ea1d 100644 --- a/specials/backup.py +++ b/specials/backup.py @@ -10,6 +10,7 @@ import xbmc from core import ziptools, videolibrarytools, filetools from platformcode import logger, config, platformtools, xbmc_videolibrary from distutils.dir_util import copy_tree +from specials import videolibrary temp_path = xbmc.translatePath("special://userdata/addon_data/plugin.video.kod/temp/") movies_path = os.path.join(temp_path, "movies") @@ -67,15 +68,14 @@ def import_videolibrary(item): unzipper = ziptools.ziptools() unzipper.extract(zip_file, temp_path) - p_dialog.update(25) + p_dialog.update(20) + if config.is_xbmc() and config.get_setting("videolibrary_kodi"): + xbmc_videolibrary.clean() + p_dialog.update(30) filetools.rmdirtree(videolibrarytools.MOVIES_PATH) filetools.rmdirtree(videolibrarytools.TVSHOWS_PATH) p_dialog.update(50) - if config.is_xbmc() and config.get_setting("videolibrary_kodi"): - strm_list = [] - strm_list.append(config.get_setting('videolibrarypath')) - xbmc_videolibrary.clean(strm_list) config.verify_directories_created() if filetools.exists(movies_path): @@ -91,9 +91,6 @@ def import_videolibrary(item): p_dialog.close() platformtools.dialog_notification(config.get_localized_string(20000), config.get_localized_string(80008), time=5000, sound=False) - if platformtools.dialog_yesno(config.get_localized_string(20000), config.get_localized_string(80009)): - import service - service.check_for_update(overwrite=True) - + videolibrary.update_videolibrary() if config.is_xbmc() and config.get_setting("videolibrary_kodi"): - xbmc_videolibrary.update() + xbmc_videolibrary.update() \ No newline at end of file diff --git a/specials/downloads.py b/specials/downloads.py index 40127b8e..8d0eb478 100644 --- a/specials/downloads.py +++ b/specials/downloads.py @@ -433,9 +433,8 @@ def move_to_libray(item): if config.is_xbmc() and config.get_setting("videolibrary_kodi"): from platformcode import xbmc_videolibrary if clean == True: - strm_list = [] - strm_list.append(file_strm_path) - xbmc_videolibrary.clean(strm_list) + path_list = [file_strm_path] + xbmc_videolibrary.clean(path_list) xbmc_videolibrary.update(FOLDER, path_title) diff --git a/specials/shortcuts.py b/specials/shortcuts.py index aa7a4ab4..acda6075 100644 --- a/specials/shortcuts.py +++ b/specials/shortcuts.py @@ -8,12 +8,12 @@ def context(): # original # if config.get_setting('quick_menu'): context.append((config.get_localized_string(60360).upper(), "XBMC.RunPlugin(plugin://plugin.video.kod/?%s)" % Item(channel='shortcuts', action="shortcut_menu").tourl())) # if config.get_setting('side_menu'): context.append((config.get_localized_string(70737).upper(), "XBMC.RunPlugin(plugin://plugin.video.kod/?%s)" % Item(channel='shortcuts',action="side_menu").tourl())) - # if config.get_setting('kod_menu'): context.append((config.get_localized_string(30025), "XBMC.RunPlugin(plugin://plugin.video.kod/?%s)" % Item(channel='shortcuts', action="settings_menu").tourl())) + # if config.get_setting('kod_menu'): context.append((config.get_localized_string(60026), "XBMC.RunPlugin(plugin://plugin.video.kod/?%s)" % Item(channel='shortcuts', action="settings_menu").tourl())) # pre-serialised - if config.get_setting('quick_menu'): context.append((config.get_localized_string(60360).upper(), 'XBMC.RunPlugin(plugin://plugin.video.kod/?ewogICAgImFjdGlvbiI6ICJzaG9ydGN1dF9tZW51IiwgCiAgICAiY2hhbm5lbCI6ICJzaG9ydGN1dHMiLCAKICAgICJpbmZvTGFiZWxzIjoge30KfQ%3D%3D)')) - if config.get_setting('side_menu'): context.append((config.get_localized_string(70737).upper(), 'XBMC.RunPlugin(plugin://plugin.video.kod/?ewogICAgImFjdGlvbiI6ICJzaWRlX21lbnUiLCAKICAgICJjaGFubmVsIjogInNob3J0Y3V0cyIsIAogICAgImluZm9MYWJlbHMiOiB7fQp9)')) - if config.get_setting('kod_menu'): context.append((config.get_localized_string(30025), 'XBMC.RunPlugin(plugin://plugin.video.kod/?ewogICAgImFjdGlvbiI6ICJzZXR0aW5nc19tZW51IiwgCiAgICAiY2hhbm5lbCI6ICJzaG9ydGN1dHMiLCAKICAgICJpbmZvTGFiZWxzIjoge30KfQ%3D%3D)')) + if config.get_setting('quick_menu'): context.append((config.get_localized_string(60360), 'XBMC.RunPlugin(plugin://plugin.video.kod/?ewogICAgImFjdGlvbiI6ICJzaG9ydGN1dF9tZW51IiwgCiAgICAiY2hhbm5lbCI6ICJzaG9ydGN1dHMiLCAKICAgICJpbmZvTGFiZWxzIjoge30KfQ%3D%3D)')) + if config.get_setting('side_menu'): context.append((config.get_localized_string(70737), 'XBMC.RunPlugin(plugin://plugin.video.kod/?ewogICAgImFjdGlvbiI6ICJzaWRlX21lbnUiLCAKICAgICJjaGFubmVsIjogInNob3J0Y3V0cyIsIAogICAgImluZm9MYWJlbHMiOiB7fQp9)')) + if config.get_setting('kod_menu'): context.append((config.get_localized_string(60026), 'XBMC.RunPlugin(plugin://plugin.video.kod/?ewogICAgImFjdGlvbiI6ICJzZXR0aW5nc19tZW51IiwgCiAgICAiY2hhbm5lbCI6ICJzaG9ydGN1dHMiLCAKICAgICJpbmZvTGFiZWxzIjoge30KfQ%3D%3D)')) return context diff --git a/specials/videolibrary.json b/specials/videolibrary.json index 26654e2d..20d3056f 100644 --- a/specials/videolibrary.json +++ b/specials/videolibrary.json @@ -4,6 +4,76 @@ "active": false, "language": ["*"], "settings": [ + { + "id": "update", + "type": "list", + "label": "@60601", + "default": 1, + "visible": true, + "lvalues": [ + "@60602", + "@60603", + "@60604", + "@60605" + ] + }, + { + "id": "update_wait", + "type": "list", + "label": "@60606", + "default": 0, + "enabled": "eq(-1,@60603)|eq(-1,@60605)", + "lvalues": [ + "No", + "@60609", + "@60610", + "@60611", + "@60612" + ] + }, + { + "id": "everyday_delay", + "type": "list", + "label": "@60613", + "default": 1, + "enabled": "eq(-2,@60604)|eq(-2,@60605)", + "lvalues": [ + "00:00", + "04:00", + "08:00", + "12:00", + "16:00", + "20:00" + ] + }, + { + "id": "updatetvshows_interval", + "type": "list", + "label": "@60614", + "default": 0, + "enabled": "!eq(-3,@60615)", + "lvalues": [ + "@60616", + "@60617" + ] + }, + { + "id": "search_new_content", + "type": "list", + "label": "@60618", + "default": 0, + "enabled": "!eq(-4,@60615)", + "lvalues": [ + "@60619", + "@60620" + ] + }, + { + "id": "local_episodes", + "type": "bool", + "label": "@80042", + "default": false + }, { "id": "lab_1", "type": "label", @@ -55,73 +125,6 @@ "pt" ] }, - { - "id": "update", - "type": "list", - "label": "@60601", - "default": 1, - "visible": true, - "lvalues": [ - "@60602", - "@60603", - "@60604", - "@60605" - ] - }, - { - "id": "update_wait", - "type": "list", - "label": "@60606", - "default": 0, - "visible": true, - "enabled": "eq(-1,@60603)|eq(-1,@60605)", - "lvalues": [ - "No", - "@60609", - "@60610", - "@60611", - "@60612" - ] - }, - { - "id": "everyday_delay", - "type": "list", - "label": "@60613", - "default": 1, - "visible": true, - "enabled": "eq(-2,@60604)|eq(-2,@60605)", - "lvalues": [ - "00:00", - "04:00", - "08:00", - "12:00", - "16:00", - "20:00" - ] - }, - { - "id": "updatetvshows_interval", - "type": "list", - "label": "@60614", - "default": 0, - "visible": true, - "enabled": "!eq(-3,@60615)", - "lvalues": [ - "@60616", - "@60617" - ] - }, - { - "id": "search_new_content", - "type": "list", - "label": "@60618", - "default": 0, - "enabled": "!eq(-4,@60615)", - "lvalues": [ - "@60619", - "@60620" - ] - }, { "id": "window_type", "type": "list", diff --git a/specials/videolibrary.py b/specials/videolibrary.py index 28208c67..0a284182 100644 --- a/specials/videolibrary.py +++ b/specials/videolibrary.py @@ -306,6 +306,14 @@ def list_tvshows(item): {"title": config.get_localized_string(70269), "action": "update_tvshow", "channel": "videolibrary"}] + if item_tvshow.local_episodes_path == "": + item_tvshow.context.append({"title": config.get_localized_string(80048), + "action": "add_local_episodes", + "channel": "videolibrary"}) + else: + item_tvshow.context.append({"title": config.get_localized_string(80049), + "action": "remove_local_episodes", + "channel": "videolibrary"}) # ,{"title": "Cambiar contenido (PENDIENTE)", # "action": "", # "channel": "videolibrary"}] @@ -322,7 +330,7 @@ def list_tvshows(item): itemlist = sorted(itemlist, key=lambda it: it.title.lower()) itemlist.append(Item(channel=item.channel, action="update_videolibrary", thumbnail=item.thumbnail, - title=config.get_localized_string(60026), folder=False)) + title=typo(config.get_localized_string(70269), 'bold color kod'), folder=False)) return itemlist @@ -679,7 +687,7 @@ def play(item): return itemlist -def update_videolibrary(item): +def update_videolibrary(item=''): logger.info() # Actualizar las series activas sobreescribiendo @@ -768,17 +776,15 @@ def delete_videolibrary(item): p_dialog = platformtools.dialog_progress_bg(config.get_localized_string(20000), config.get_localized_string(80038)) p_dialog.update(0) - filetools.rmdirtree(videolibrarytools.MOVIES_PATH) - p_dialog.update(40) - filetools.rmdirtree(videolibrarytools.TVSHOWS_PATH) - p_dialog.update(80) if config.is_xbmc() and config.get_setting("videolibrary_kodi"): from platformcode import xbmc_videolibrary - strm_list = [] - strm_list.append(config.get_setting('videolibrarypath')) - xbmc_videolibrary.clean(strm_list) - + xbmc_videolibrary.clean() + p_dialog.update(10) + filetools.rmdirtree(videolibrarytools.MOVIES_PATH) + p_dialog.update(50) + filetools.rmdirtree(videolibrarytools.TVSHOWS_PATH) p_dialog.update(90) + config.verify_directories_created() p_dialog.update(100) xbmc.sleep(1000) @@ -796,12 +802,59 @@ def update_tvshow(item): p_dialog.update(0, heading, item.contentSerieName) import service - if service.update(item.path, p_dialog, 1, 1, item, False) and config.is_xbmc() and config.get_setting("videolibrary_kodi"): + if service.update(item.path, p_dialog, 0, 100, item, False) and config.is_xbmc() and config.get_setting("videolibrary_kodi"): from platformcode import xbmc_videolibrary xbmc_videolibrary.update(folder=filetools.basename(item.path)) p_dialog.close() + # check if the TV show is ended or has been canceled and ask the user to remove it from the video library update + nfo_path = filetools.join(item.path, "tvshow.nfo") + head_nfo, item_nfo = videolibrarytools.read_nfo(nfo_path) + if item.active and not item_nfo.active: + if not platformtools.dialog_yesno(config.get_localized_string(60037).replace('...',''), config.get_localized_string(70268) % item.contentSerieName): + item_nfo.active = 1 + filetools.write(nfo_path, head_nfo + item_nfo.tojson()) + + platformtools.itemlist_refresh() + + +def add_local_episodes(item): + logger.info() + + done, local_episodes_path = videolibrarytools.config_local_episodes_path(item.path, item.contentSerieName) + if done < 0: + logger.info("An issue has occurred while configuring local episodes") + elif local_episodes_path: + nfo_path = filetools.join(item.path, "tvshow.nfo") + head_nfo, item_nfo = videolibrarytools.read_nfo(nfo_path) + item_nfo.local_episodes_path = local_episodes_path + if not item_nfo.active: + item_nfo.active = 1 + filetools.write(nfo_path, head_nfo + item_nfo.tojson()) + + update_tvshow(item) + + platformtools.itemlist_refresh() + + +def remove_local_episodes(item): + logger.info() + + nfo_path = filetools.join(item.path, "tvshow.nfo") + head_nfo, item_nfo = videolibrarytools.read_nfo(nfo_path) + + for season_episode in item_nfo.local_episodes_list: + filetools.remove(filetools.join(item.path, season_episode + '.strm')) + + item_nfo.local_episodes_list = [] + item_nfo.local_episodes_path = '' + filetools.write(nfo_path, head_nfo + item_nfo.tojson()) + + update_tvshow(item) + + platformtools.itemlist_refresh() + def verify_playcount_series(item, path): logger.info() @@ -1025,22 +1078,24 @@ def delete(item): for file in filetools.listdir(_item.path): if file.endswith(".strm") or file.endswith(".nfo") or file.endswith(".json")or file.endswith(".torrent"): filetools.remove(filetools.join(_item.path, file)) - raiz, carpeta_serie, ficheros = next(filetools.walk(_item.path)) - if ficheros == []: - filetools.rmdir(_item.path) + + if _item.contentType == 'movie': + heading = config.get_localized_string(70084) else: - if _item.contentType == 'movie': - heading = config.get_localized_string(70084) - else: - heading = config.get_localized_string(70085) - if platformtools.dialog_yesno(heading, config.get_localized_string(70081)): - filetools.rmdirtree(_item.path) + heading = config.get_localized_string(70085) if config.is_xbmc() and config.get_setting("videolibrary_kodi"): from platformcode import xbmc_videolibrary - strm_list = [] - strm_list.append(_item.extra) - xbmc_videolibrary.clean(strm_list) + if _item.local_episodes_path: + platformtools.dialog_ok(heading, config.get_localized_string(80047) % _item.infoLabels['title']) + path_list = [_item.extra] + xbmc_videolibrary.clean(path_list) + + raiz, carpeta_serie, ficheros = next(filetools.walk(_item.path)) + if ficheros == []: + filetools.rmdir(_item.path) + elif platformtools.dialog_yesno(heading, config.get_localized_string(70081) % os.path.basename(_item.path)): + filetools.rmdirtree(_item.path) logger.info("All links removed") xbmc.sleep(1000) @@ -1068,8 +1123,8 @@ def delete(item): if index == 0: # Seleccionado Eliminar pelicula/serie - canal = None delete_all(item) + return elif index > 0: # Seleccionado Eliminar canal X @@ -1080,41 +1135,43 @@ def delete(item): else: canal = item.dead - if canal: - num_enlaces = 0 - strm_list = [] - for fd in filetools.listdir(item.path): - if fd.endswith(canal + '].json') or scrapertools.find_single_match(fd, '%s]_\d+.torrent' % canal): - if filetools.remove(filetools.join(item.path, fd)): - num_enlaces += 1 - # Remove strm and nfo if no other channel - episode = fd.replace(' [' + canal + '].json', '') - found_ch = False - for ch in channels: - if filetools.exists(filetools.join(item.path, episode + ' [' + ch + '].json')): - found_ch = True - break - if found_ch == False: - filetools.remove(filetools.join(item.path, episode + '.nfo')) - filetools.remove(filetools.join(item.path, episode + '.strm')) - strm_list.append(filetools.join(item.extra, episode + '.strm')) + num_enlaces = 0 + path_list = [] + for fd in filetools.listdir(item.path): + if fd.endswith(canal + '].json') or scrapertools.find_single_match(fd, '%s]_\d+.torrent' % canal): + if filetools.remove(filetools.join(item.path, fd)): + num_enlaces += 1 + # Remove strm and nfo if no other channel + episode = fd.replace(' [' + canal + '].json', '') + found_ch = False + for ch in channels: + if filetools.exists(filetools.join(item.path, episode + ' [' + ch + '].json')): + found_ch = True + break + if found_ch == False: + filetools.remove(filetools.join(item.path, episode + '.nfo')) + strm_path = filetools.join(item.path, episode + '.strm') + # if it is a local episode, do not delete the strm + if 'plugin://plugin.video.kod/?' in filetools.read(strm_path): + filetools.remove(strm_path) + path_list.append(filetools.join(item.extra, episode + '.strm')) - if config.is_xbmc() and config.get_setting("videolibrary_kodi") and strm_list: - from platformcode import xbmc_videolibrary - xbmc_videolibrary.clean(strm_list) + if config.is_xbmc() and config.get_setting("videolibrary_kodi") and path_list: + from platformcode import xbmc_videolibrary + xbmc_videolibrary.clean(path_list) - if num_enlaces > 0: - # Actualizar .nfo - head_nfo, item_nfo = videolibrarytools.read_nfo(item.nfo) - del item_nfo.library_urls[canal] - if item_nfo.emergency_urls and item_nfo.emergency_urls.get(canal, False): - del item_nfo.emergency_urls[canal] - filetools.write(item.nfo, head_nfo + item_nfo.tojson()) + if num_enlaces > 0: + # Actualizar .nfo + head_nfo, item_nfo = videolibrarytools.read_nfo(item.nfo) + del item_nfo.library_urls[canal] + if item_nfo.emergency_urls and item_nfo.emergency_urls.get(canal, False): + del item_nfo.emergency_urls[canal] + filetools.write(item.nfo, head_nfo + item_nfo.tojson()) - msg_txt = config.get_localized_string(70087) % (num_enlaces, canal) - logger.info(msg_txt) - platformtools.dialog_notification(heading, msg_txt) - platformtools.itemlist_refresh() + msg_txt = config.get_localized_string(70087) % (num_enlaces, canal) + logger.info(msg_txt) + platformtools.dialog_notification(heading, msg_txt) + platformtools.itemlist_refresh() else: if platformtools.dialog_yesno(heading, config.get_localized_string(70088) % item.infoLabels['title']):