Aggiunta verifica sui percorsi videoteca KoD / libreria Kodi
This commit is contained in:
@@ -28,9 +28,9 @@ VIDEOLIBRARY_PATH = config.get_videolibrary_path()
|
||||
MOVIES_PATH = filetools.join(VIDEOLIBRARY_PATH, FOLDER_MOVIES)
|
||||
TVSHOWS_PATH = filetools.join(VIDEOLIBRARY_PATH, FOLDER_TVSHOWS)
|
||||
|
||||
if not FOLDER_MOVIES or not FOLDER_TVSHOWS or not VIDEOLIBRARY_PATH \
|
||||
"""if not FOLDER_MOVIES or not FOLDER_TVSHOWS or not VIDEOLIBRARY_PATH \
|
||||
or not filetools.exists(MOVIES_PATH) or not filetools.exists(TVSHOWS_PATH):
|
||||
config.verify_directories_created()
|
||||
config.verify_directories_created()"""
|
||||
|
||||
addon_name = "plugin://plugin.video.%s/" % config.PLUGIN_NAME
|
||||
|
||||
|
||||
@@ -1034,6 +1034,28 @@ def execute_sql_kodi(sql):
|
||||
return nun_records, records
|
||||
|
||||
|
||||
def check_sources(new_movies_path='', new_tvshows_path=''):
|
||||
logger.info()
|
||||
|
||||
try:
|
||||
SOURCES_PATH = xbmc.translatePath("special://userdata/sources.xml")
|
||||
if filetools.isfile(SOURCES_PATH):
|
||||
xmldoc = minidom.parse(SOURCES_PATH)
|
||||
|
||||
# collect nodes
|
||||
# nodes = xmldoc.getElementsByTagName("video")
|
||||
video_node = xmldoc.childNodes[0].getElementsByTagName("video")[0]
|
||||
paths_node = video_node.getElementsByTagName("path")
|
||||
|
||||
# check paths
|
||||
list_path = [p.firstChild.data for p in paths_node]
|
||||
if new_movies_path in list_path or new_tvshows_path in list_path:
|
||||
return True
|
||||
return False
|
||||
except:
|
||||
return True
|
||||
|
||||
|
||||
def update_sources(new='', old=''):
|
||||
logger.info()
|
||||
if new == old: return True
|
||||
|
||||
@@ -6177,4 +6177,8 @@ msgstr ""
|
||||
|
||||
msgctxt "#80027"
|
||||
msgid "You will be asked to configure The Movie Database for movies and The TVDB for TV shows"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#80028"
|
||||
msgid "The path and/or the folders you selected are already used by the Kodi library. Please select other ones"
|
||||
msgstr ""
|
||||
@@ -6177,4 +6177,8 @@ msgstr "Configurazione della libreria di Kodi"
|
||||
|
||||
msgctxt "#80027"
|
||||
msgid "You will be asked to configure The Movie Database for movies and The TVDB for TV shows"
|
||||
msgstr "Ti verrà chiesto di configurare The Movie Database per i film e The TVDB per le serie TV"
|
||||
msgstr "Ti verrà chiesto di configurare The Movie Database per i film e The TVDB per le serie TV"
|
||||
|
||||
msgctxt "#80028"
|
||||
msgid "The path and/or the folders you selected are already used by the Kodi library. Please select other ones"
|
||||
msgstr "Il percorso e/o le cartelle selezionate sono già utilizzati dalla libreria di Kodi. Si prega di selezionarne altri"
|
||||
@@ -704,6 +704,17 @@ def move_videolibrary(current_path, new_path, current_movies_folder, new_movies_
|
||||
current_tvshows_path = os.path.join(current_path, current_tvshows_folder)
|
||||
new_tvshows_path = os.path.join(new_path, new_tvshows_folder)
|
||||
|
||||
from platformcode import xbmc_videolibrary
|
||||
if xbmc_videolibrary.check_sources(new_movies_path+'\\', new_tvshows_path+'\\'):
|
||||
config.set_setting("videolibrarypath", current_path)
|
||||
config.set_setting("folder_movies", current_movies_folder)
|
||||
config.set_setting("folder_tvshows", current_tvshows_folder)
|
||||
progress.update(100)
|
||||
xbmc.sleep(1000)
|
||||
progress.close()
|
||||
platformtools.dialog_ok(config.get_localized_string(20000), config.get_localized_string(80028))
|
||||
return
|
||||
|
||||
config.verify_directories_created()
|
||||
progress.update(10, config.get_localized_string(20000), config.get_localized_string(80012))
|
||||
if current_movies_path != new_movies_path:
|
||||
@@ -721,7 +732,6 @@ def move_videolibrary(current_path, new_path, current_movies_folder, new_movies_
|
||||
if current_path != new_path and not filetools.listdir(current_path) and not "plugin.video.kod\\videolibrary" in current_path:
|
||||
filetools.rmdirtree(current_path)
|
||||
|
||||
from platformcode import xbmc_videolibrary
|
||||
xbmc_videolibrary.update_sources(backup_new_path, backup_current_path)
|
||||
if config.is_xbmc() and config.get_setting("videolibrary_kodi"):
|
||||
xbmc_videolibrary.update_db(backup_current_path, backup_new_path, current_movies_folder, new_movies_folder, current_tvshows_folder, new_tvshows_folder, progress)
|
||||
|
||||
Reference in New Issue
Block a user