Configurazione libreria Kodi rivista

This commit is contained in:
axlt2002
2020-03-29 01:49:31 +01:00
parent f351270c6f
commit b50a704260
11 changed files with 311 additions and 252 deletions
+11 -11
View File
@@ -115,7 +115,7 @@ def mainlist(item):
# if there's at least one downloading
if 4 in estados:
itemlist.insert(0, Item(channel=item.channel, action="stop_all", title=config.get_localized_string(80017),
itemlist.insert(0, Item(channel=item.channel, action="stop_all", title=config.get_localized_string(60222),
contentType=item.contentType, contentChannel=item.contentChannel,
contentSerieName=item.contentSerieName,
text_color=STATUS_COLORS[STATUS_CODES.downloading]))
@@ -254,8 +254,8 @@ def menu(item):
servidor = "Auto"
# Opciones disponibles para el menu
op = [config.get_localized_string(70225), config.get_localized_string(70226), config.get_localized_string(70227),
config.get_localized_string(30165) % (servidor.capitalize()), config.get_localized_string(80015),
config.get_localized_string(80016)]
config.get_localized_string(30165) % (servidor.capitalize()), config.get_localized_string(60220),
config.get_localized_string(60221)]
opciones = []
@@ -369,14 +369,14 @@ def move_to_libray(item):
logger.info('Delete File: ' + str(filetools.join(config.get_videolibrary_path(), FOLDER, path_title, File)))
filetools.remove(filetools.join(config.get_videolibrary_path(), FOLDER, path_title, File))
from platformcode import xbmc_videolibrary
xbmc_videolibrary.update(FOLDER)
if clean == True:
import xbmc
while xbmc.getCondVisibility('Library.IsScanningVideo()'):
xbmc.sleep(500)
xbmc_videolibrary.clean()
if config.get_setting("videolibrary_kodi"):
from platformcode import xbmc_videolibrary
xbmc_videolibrary.update(FOLDER)
if clean == True:
import xbmc
while xbmc.getCondVisibility('Library.IsScanningVideo()'):
xbmc.sleep(500)
xbmc_videolibrary.clean()
if config.get_setting("library_add") == True and config.get_setting("library_move") == False:
if filetools.isfile(final_path):
+38 -41
View File
@@ -20,44 +20,41 @@ def move_videolibrary(current_path, new_path, current_movies_folder, new_movies_
backup_current_path = current_path
backup_new_path = new_path
if current_path != new_path or current_movies_folder != new_movies_folder or current_tvshows_folder != new_tvshows_folder:
notify = False
progress = platformtools.dialog_progress_bg(config.get_localized_string(20000), config.get_localized_string(80011))
current_path = xbmc.translatePath(current_path)
new_path = xbmc.translatePath(new_path)
current_movies_path = filetools.join(current_path, current_movies_folder)
new_movies_path = filetools.join(new_path, new_movies_folder)
current_tvshows_path = os.path.join(current_path, current_tvshows_folder)
new_tvshows_path = os.path.join(new_path, new_tvshows_folder)
notify = False
progress = platformtools.dialog_progress_bg(config.get_localized_string(20000), config.get_localized_string(80011))
current_path = xbmc.translatePath(current_path)
new_path = xbmc.translatePath(new_path)
current_movies_path = filetools.join(current_path, current_movies_folder)
new_movies_path = filetools.join(new_path, new_movies_folder)
current_tvshows_path = os.path.join(current_path, current_tvshows_folder)
new_tvshows_path = os.path.join(new_path, new_tvshows_folder)
config.verify_directories_created()
progress.update(10, config.get_localized_string(20000), config.get_localized_string(80012))
if current_movies_path != new_movies_path:
if filetools.listdir(current_movies_path):
dir_util.copy_tree(current_movies_path, new_movies_path)
notify = True
filetools.rmdirtree(current_movies_path)
progress.update(40)
if current_tvshows_path != new_tvshows_path:
if filetools.listdir(current_tvshows_path):
dir_util.copy_tree(current_tvshows_path, new_tvshows_path)
notify = True
filetools.rmdirtree(current_tvshows_path)
progress.update(70)
if current_path != new_path and not filetools.listdir(current_path) and not "plugin.video.kod\\videolibrary" in current_path:
filetools.rmdirtree(current_path)
config.verify_directories_created()
progress.update(10, config.get_localized_string(20000), config.get_localized_string(80012))
if current_movies_path != new_movies_path:
if filetools.listdir(current_movies_path):
dir_util.copy_tree(current_movies_path, new_movies_path)
notify = True
filetools.rmdirtree(current_movies_path)
progress.update(40)
if current_tvshows_path != new_tvshows_path:
if filetools.listdir(current_tvshows_path):
dir_util.copy_tree(current_tvshows_path, new_tvshows_path)
notify = True
filetools.rmdirtree(current_tvshows_path)
progress.update(70)
if current_path != new_path and not filetools.listdir(current_path) and not "plugin.video.kod\\videolibrary" in current_path:
filetools.rmdirtree(current_path)
if config.is_xbmc() and config.get_setting("videolibrary_kodi"):
set_new_path(backup_current_path, backup_new_path)
update_db(backup_current_path, backup_new_path, current_movies_folder, new_movies_folder, current_tvshows_folder, new_tvshows_folder, progress)
clear_cache()
else:
progress.update(90, config.get_localized_string(20000), config.get_localized_string(80013))
if config.is_xbmc() and config.get_setting("videolibrary_kodi"):
update_sources(backup_current_path, backup_new_path)
update_db(backup_current_path, backup_new_path, current_movies_folder, new_movies_folder, current_tvshows_folder, new_tvshows_folder, progress)
clear_cache()
progress.update(100)
progress.close()
if notify:
platformtools.dialog_notification(config.get_localized_string(20000), config.get_localized_string(80014), icon=0, time=5000, sound=False)
progress.update(100)
progress.close()
if notify:
platformtools.dialog_notification(config.get_localized_string(20000), config.get_localized_string(80014), icon=0, time=5000, sound=False)
def update_db(current_path, new_path, current_movies_folder, new_movies_folder, current_tvshows_folder, new_tvshows_folder, progress):
@@ -95,7 +92,7 @@ def update_db(current_path, new_path, current_movies_folder, new_movies_folder,
nun_records, records = xbmc_videolibrary.execute_sql_kodi(sql)
p = 80
progress.update(90, config.get_localized_string(20000), config.get_localized_string(80013))
progress.update(p, config.get_localized_string(20000), config.get_localized_string(80013))
OLD = old
for OldPath, NewPath in [[current_movies_folder, new_movies_folder], [current_tvshows_folder, new_tvshows_folder]]:
@@ -151,12 +148,12 @@ def update_db(current_path, new_path, current_movies_folder, new_movies_folder,
sql = 'UPDATE episode SET c18="%s" WHERE idEpisode=%s' % (strPath, idEpisode)
nun_records, records = xbmc_videolibrary.execute_sql_kodi(sql)
p += 5
progress.update(90, config.get_localized_string(20000), config.get_localized_string(80013))
progress.update(p, config.get_localized_string(20000), config.get_localized_string(80013))
def clear_videolibrary_db():
def clear_db():
log()
progress = platformtools.dialog_progress_bg(config.get_localized_string(20000), config.get_localized_string(60601))
progress = platformtools.dialog_progress_bg(config.get_localized_string(20000), config.get_localized_string(80025))
progress.update(0)
@@ -217,13 +214,13 @@ def clear_videolibrary_db():
sql = 'DELETE from episode WHERE idEpisode=%s' % idEpisode
nun_records, records = xbmc_videolibrary.execute_sql_kodi(sql)
progress.update(80)
set_new_path(path)
update_sources(path)
clear_cache()
progress.update(100)
progress.close()
def set_new_path(old, new=''):
def update_sources(old, new=''):
log()
if new == old: return
+4 -4
View File
@@ -693,7 +693,7 @@ def update_tvshow(item):
p_dialog.update(0, heading, item.contentSerieName)
import videolibrary_service
if videolibrary_service.update(item.path, p_dialog, 1, 1, item, False) and config.is_xbmc():
if videolibrary_service.update(item.path, p_dialog, 1, 1, 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))
@@ -926,10 +926,10 @@ def delete(item):
if ficheros == []:
filetools.rmdir(_item.path)
if config.is_xbmc():
if config.is_xbmc() and config.get_setting("videolibrary_kodi"):
import xbmc
# esperamos 3 segundos para dar tiempo a borrar los ficheros
xbmc.sleep(3000)
# esperamos 5 segundos para dar tiempo a borrar los ficheros
xbmc.sleep(5000)
# TODO mirar por qué no funciona al limpiar en la videoteca de Kodi al añadirle un path
# limpiamos la videoteca de Kodi
from platformcode import xbmc_videolibrary