Merge remote-tracking branch 'origin/master'

This commit is contained in:
marco
2020-03-31 23:45:39 +02:00
3 changed files with 47 additions and 20 deletions

View File

@@ -796,6 +796,16 @@ def set_content(content_type, silent=False, custom=False):
def update_db(current_path, new_path, current_movies_folder, new_movies_folder, current_tvshows_folder, new_tvshows_folder, progress):
def path_replace(path, old, new):
if new.startswith("special://") or '://' in new: sep = '/'
else: sep = os.sep
path = path.replace(old,new)
if sep == '/': path = path.replace('\\','/')
else: path = path.replace('/','\\')
return path
logger.info()
new = new_path
@@ -825,7 +835,7 @@ def update_db(current_path, new_path, current_movies_folder, new_movies_folder,
# change main path
if records:
idPath = records[0][0]
strPath = records[0][1].replace(current_path, new_path)
strPath = path_replace(records[0][1], current_path, new_path)
sql = 'UPDATE path SET strPath="%s" WHERE idPath=%s' % (strPath, idPath)
nun_records, records = execute_sql_kodi(sql)
@@ -845,7 +855,7 @@ def update_db(current_path, new_path, current_movies_folder, new_movies_folder,
if records:
for record in records:
idPath = record[0]
strPath = record[1].replace(filetools.join(current_path, OldPath), filetools.join(new_path, NewPath))
strPath = path_replace(record[1], filetools.join(current_path, OldPath), filetools.join(new_path, NewPath))
sql = 'UPDATE path SET strPath="%s"WHERE idPath=%s' % (strPath, idPath)
nun_records, records = execute_sql_kodi(sql)
@@ -858,7 +868,7 @@ def update_db(current_path, new_path, current_movies_folder, new_movies_folder,
if records:
for record in records:
idPath = record[0]
strPath = record[1].replace(filetools.join(current_path, OldPath), filetools.join(new_path, NewPath))
strPath = path_replace(record[1], filetools.join(current_path, OldPath), filetools.join(new_path, NewPath))
sql = 'UPDATE path SET strPath="%s"WHERE idPath=%s' % (strPath, idPath)
nun_records, records = execute_sql_kodi(sql)
@@ -871,7 +881,7 @@ def update_db(current_path, new_path, current_movies_folder, new_movies_folder,
if records:
for record in records:
idMovie = record[0]
strPath = record[1].replace(filetools.join(current_path, OldPath), filetools.join(new_path, NewPath))
strPath = path_replace(record[1], filetools.join(current_path, OldPath), filetools.join(new_path, NewPath))
sql = 'UPDATE movie SET c22="%s" WHERE idMovie=%s' % (strPath, idMovie)
nun_records, records = execute_sql_kodi(sql)
# search and modify in "movie_view"
@@ -880,8 +890,8 @@ def update_db(current_path, new_path, current_movies_folder, new_movies_folder,
if records:
for record in records:
idMovie = record[0]
c22 = record[1].replace(filetools.join(current_path, OldPath), filetools.join(new_path, NewPath))
strPath = record[2].replace(filetools.join(current_path, OldPath), filetools.join(new_path, NewPath))
c22 = path_replace(record[1], filetools.join(current_path, OldPath), filetools.join(new_path, NewPath))
strPath = path_replace(record[2], filetools.join(current_path, OldPath), filetools.join(new_path, NewPath))
sql = 'UPDATE movie_view SET c22="%s", strPath="%s" WHERE idMovie=%s' % (c22, strPath, idMovie)
nun_records, records = execute_sql_kodi(sql)
else:
@@ -892,7 +902,7 @@ def update_db(current_path, new_path, current_movies_folder, new_movies_folder,
if records:
for record in records:
idEpisode = record[0]
strPath = record[1].replace(filetools.join(current_path, OldPath), filetools.join(new_path, NewPath))
strPath = path_replace(record[1], filetools.join(current_path, OldPath), filetools.join(new_path, NewPath))
sql = 'UPDATE episode SET c18="%s" WHERE idEpisode=%s' % (strPath, idEpisode)
nun_records, records = execute_sql_kodi(sql)
# search and modify in "episode_view"
@@ -901,8 +911,8 @@ def update_db(current_path, new_path, current_movies_folder, new_movies_folder,
if records:
for record in records:
idEpisode = record[0]
c18 = record[1].replace(filetools.join(current_path, OldPath), filetools.join(new_path, NewPath))
strPath = record[2].replace(filetools.join(current_path, OldPath), filetools.join(new_path, NewPath))
c18 = path_replace(record[1], filetools.join(current_path, OldPath), filetools.join(new_path, NewPath))
strPath = path_replace(record[2], filetools.join(current_path, OldPath), filetools.join(new_path, NewPath))
sql = 'UPDATE episode_view SET c18="%s", strPath="%s" WHERE idEpisode=%s' % (c18, strPath, idEpisode)
nun_records, records = execute_sql_kodi(sql)
# search and modify in "season_view"
@@ -911,7 +921,7 @@ def update_db(current_path, new_path, current_movies_folder, new_movies_folder,
if records:
for record in records:
idSeason = record[0]
strPath = record[1].replace(filetools.join(current_path, OldPath), filetools.join(new_path, NewPath))
strPath = path_replace(record[1], filetools.join(current_path, OldPath), filetools.join(new_path, NewPath))
sql = 'UPDATE season_view SET strPath="%s" WHERE idSeason=%s' % (strPath, idSeason)
nun_records, records = execute_sql_kodi(sql)
# search and modify in "tvshow_view"
@@ -920,7 +930,7 @@ def update_db(current_path, new_path, current_movies_folder, new_movies_folder,
if records:
for record in records:
idShow = record[0]
strPath = record[1].replace(filetools.join(current_path, OldPath), filetools.join(new_path, NewPath))
strPath = path_replace(record[1], filetools.join(current_path, OldPath), filetools.join(new_path, NewPath))
sql = 'UPDATE tvshow_view SET strPath="%s" WHERE idShow=%s' % (strPath, idShow)
nun_records, records = execute_sql_kodi(sql)
p += 5
@@ -1220,7 +1230,7 @@ def clear_cache():
path = xbmc.translatePath('special://home/cache/archive_cache/')
for file in filetools.listdir(path):
filetools.remove(filetools.join(path, file))
xbmc.executebuiltin('XBMC.ReloadSkin()')
# xbmc.executebuiltin('XBMC.ReloadSkin()')
def ask_set_content(silent=False):
@@ -1231,16 +1241,16 @@ def ask_set_content(silent=False):
if set_content("movie", True, custom) and set_content("tvshow", True, custom) and \
add_sources(config.get_setting("videolibrarypath")) and \
add_sources(config.get_setting("downloadpath")):
platformtools.dialog_ok(config.get_localized_string(20000), config.get_localized_string(70104))
platformtools.dialog_ok(config.get_localized_string(80026), config.get_localized_string(70104))
config.set_setting("videolibrary_kodi", True)
update()
else:
platformtools.dialog_ok(config.get_localized_string(20000), config.get_localized_string(80024))
platformtools.dialog_ok(config.get_localized_string(80026), config.get_localized_string(80024))
config.set_setting("videolibrary_kodi", False)
if not silent:
if platformtools.dialog_yesno(config.get_localized_string(20000), config.get_localized_string(80015)):
if not platformtools.dialog_yesno(config.get_localized_string(20000), config.get_localized_string(80016), "", "", config.get_localized_string(80017), config.get_localized_string(80018)):
if not platformtools.dialog_yesno(config.get_localized_string(80026), config.get_localized_string(80016), "", "", config.get_localized_string(80017), config.get_localized_string(80018)):
path = platformtools.dialog_browse(3, config.get_localized_string(80019), config.get_setting("videolibrarypath"))
if path != "":
config.set_setting("videolibrarypath", path)
@@ -1253,6 +1263,7 @@ def ask_set_content(silent=False):
config.verify_directories_created()
do_config(True)
else:
platformtools.dialog_ok(config.get_localized_string(80026), config.get_localized_string(80027))
do_config(False)
else:
# no hemos aceptado
@@ -1260,5 +1271,5 @@ def ask_set_content(silent=False):
config.set_setting("videolibrary_kodi", False)
else:
platformtools.dialog_ok(config.get_localized_string(20000), config.get_localized_string(80023))
platformtools.dialog_ok(config.get_localized_string(80026), config.get_localized_string(80023))
do_config(True)

View File

@@ -6132,7 +6132,7 @@ msgid "You can configure the Kodi video library later from the Settings menu ins
msgstr ""
msgctxt "#80023"
msgid "Configuration of Kodi video library. You will be asked to configure the information providers for movies and TV shows"
msgid "You will be asked to choose and configure the information providers for movies and TV shows"
msgstr ""
msgctxt "#80024"
@@ -6141,4 +6141,12 @@ msgstr ""
msgctxt "#80025"
msgid "Cleaning database..."
msgstr ""
msgctxt "#80026"
msgid "Configuration of Kodi video library"
msgstr ""
msgctxt "#80027"
msgid "You will be asked to configure The Movie Database for movies and The TVDB for TV shows"
msgstr ""

View File

@@ -6132,8 +6132,8 @@ msgid "You can configure the Kodi video library later from the Settings menu ins
msgstr "Potrai configurare la libreria di Kodi in seguito dal menu Impostazioni all'interno di KoD"
msgctxt "#80023"
msgid "Configuration of Kodi video library. You will be asked to configure the information providers for movies and TV shows"
msgstr "Configurazione della libreria di Kodi. Ti verrà chiesto di configurare i provider delle informazioni per film e serie TV"
msgid "You will be asked to choose and configure the information providers for movies and TV shows"
msgstr "Ti verrà chiesto di scegliere e configurare i provider delle informazioni per film e serie TV"
msgctxt "#80024"
msgid "An error has occurred during the configuration of the Kodi video library. Please check the log and try again from the Settings menu inside KoD"
@@ -6141,4 +6141,12 @@ msgstr "Si è verificato un errore durante la configurazione della libreria di K
msgctxt "#80025"
msgid "Cleaning database..."
msgstr "Pulizia database..."
msgstr "Pulizia database..."
msgctxt "#80026"
msgid "Configuration of Kodi video library"
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"