This commit is contained in:
mac12m99
2021-05-22 17:43:43 +02:00
parent ba98922a9c
commit 228c7bbd79
3 changed files with 2 additions and 219 deletions
-77
View File
@@ -708,83 +708,6 @@ def channel_status(item, dict_values):
platformtools.dialog_notification(config.get_localized_string(60579), config.get_localized_string(60580))
def restore_tools(item):
import service
from core import videolibrarytools
import os
seleccion = platformtools.dialog_yesno(config.get_localized_string(60581),
config.get_localized_string(60582) + '\n' +
config.get_localized_string(60583))
if seleccion == 1:
# tvshows
heading = config.get_localized_string(60584)
p_dialog = platformtools.dialog_progress_bg(config.get_localized_string(60585), heading)
p_dialog.update(0, '')
show_list = []
for path, folders, files in filetools.walk(videolibrarytools.TVSHOWS_PATH):
show_list.extend([filetools.join(path, f) for f in files if f == "tvshow.nfo"])
if show_list:
t = float(100) / len(show_list)
for i, tvshow_file in enumerate(show_list):
head_nfo, serie = videolibrarytools.read_nfo(tvshow_file)
path = filetools.dirname(tvshow_file)
if not serie.active:
# if the series is not active discard
continue
# We delete the folder with the series ...
if tvshow_file.endswith('.strm') or tvshow_file.endswith('.json') or tvshow_file.endswith('.nfo'):
os.remove(os.path.join(path, tvshow_file))
# filetools.rmdirtree(path)
# ... and we add it again
service.update(path, p_dialog, i, t, serie, 3)
p_dialog.close()
# movies
heading = config.get_localized_string(60586)
p_dialog2 = platformtools.dialog_progress_bg(config.get_localized_string(60585), heading)
p_dialog2.update(0, '')
movies_list = []
for path, folders, files in filetools.walk(videolibrarytools.MOVIES_PATH):
movies_list.extend([filetools.join(path, f) for f in files if f.endswith(".json")])
logger.debug("movies_list %s" % movies_list)
if movies_list:
t = float(100) / len(movies_list)
for i, movie_json in enumerate(movies_list):
try:
from core import jsontools
path = filetools.dirname(movie_json)
movie = Item().fromjson(filetools.read(movie_json))
# We delete the folder with the movie ...
filetools.rmdirtree(path)
import math
heading = config.get_localized_string(20000)
p_dialog2.update(int(math.ceil((i + 1) * t)), heading, config.get_localized_string(60389) % (movie.contentTitle,
movie.channel.capitalize()))
# ... and we add it again
videolibrarytools.save_movie(movie)
except Exception as ex:
logger.error("Error creating movie again")
template = "An exception of type %s occured. Arguments:\n%r"
message = template % (type(ex).__name__, ex.args)
logger.error(message)
p_dialog2.close()
def report_menu(item):
logger.debug('URL: ' + item.url)