controllo validità canali in videoteca spostato in findvideos, eliminazione da tutta la videoteca invece che dal singolo film/serie
This commit is contained in:
@@ -6,7 +6,6 @@
|
|||||||
|
|
||||||
from core import support
|
from core import support
|
||||||
|
|
||||||
|
|
||||||
host = support.config.get_channel_url()
|
host = support.config.get_channel_url()
|
||||||
headers = [['Referer', host]]
|
headers = [['Referer', host]]
|
||||||
|
|
||||||
|
|||||||
@@ -48,18 +48,12 @@ def dialog_notification(heading, message, icon=3, time=5000, sound=True):
|
|||||||
|
|
||||||
|
|
||||||
def dialog_yesno(heading, message, nolabel=config.get_localized_string(70170), yeslabel=config.get_localized_string(30022), autoclose=0, customlabel=None):
|
def dialog_yesno(heading, message, nolabel=config.get_localized_string(70170), yeslabel=config.get_localized_string(30022), autoclose=0, customlabel=None):
|
||||||
# customlabel only on kodi 19
|
|
||||||
dialog = xbmcgui.Dialog()
|
dialog = xbmcgui.Dialog()
|
||||||
if PY3:
|
# customlabel only work on kodi 19
|
||||||
if autoclose:
|
if PY3 and customlabel:
|
||||||
return dialog.yesno(heading, message, nolabel=nolabel, yeslabel=yeslabel, customlabel=customlabel, autoclose=autoclose)
|
return dialog.yesno(heading, message, customlabel, nolabel=nolabel, yeslabel=yeslabel, autoclose=autoclose)
|
||||||
else:
|
|
||||||
return dialog.yesno(heading, message, nolabel=nolabel, yeslabel=yeslabel, customlabel=customlabel)
|
|
||||||
else:
|
else:
|
||||||
if autoclose:
|
return dialog.yesno(heading, message, nolabel=nolabel, yeslabel=yeslabel, autoclose=autoclose)
|
||||||
return dialog.yesno(heading, message, nolabel=nolabel, yeslabel=yeslabel, autoclose=autoclose)
|
|
||||||
else:
|
|
||||||
return dialog.yesno(heading, message, nolabel=nolabel, yeslabel=yeslabel)
|
|
||||||
|
|
||||||
|
|
||||||
def dialog_select(heading, _list, preselect=0, useDetails=False):
|
def dialog_select(heading, _list, preselect=0, useDetails=False):
|
||||||
|
|||||||
@@ -320,7 +320,7 @@ msgid "It seems that the Channel %s no longer exists."
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgctxt "#30133"
|
msgctxt "#30133"
|
||||||
msgid "Do you want to remove links from this channel?"
|
msgid "Do you want to remove ALL links from this channel?"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgctxt "#30135"
|
msgctxt "#30135"
|
||||||
@@ -665,7 +665,7 @@ msgid "No connector for the server %s"
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgctxt "#60005"
|
msgctxt "#60005"
|
||||||
msgid ""
|
msgid "Deleting all links from channel %s"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgctxt "#60006"
|
msgctxt "#60006"
|
||||||
|
|||||||
@@ -320,8 +320,8 @@ msgid "It seems that the Channel %s no longer exists."
|
|||||||
msgstr "Sembra che il canale %s non esista più."
|
msgstr "Sembra che il canale %s non esista più."
|
||||||
|
|
||||||
msgctxt "#30133"
|
msgctxt "#30133"
|
||||||
msgid "Do you want to remove links from this channel?"
|
msgid "Do you want to remove ALL links from this channel?"
|
||||||
msgstr "Vuoi rimuovere i collegamenti da questo canale?"
|
msgstr "Vuoi rimuovere TUTTI i collegamenti da questo canale?"
|
||||||
|
|
||||||
msgctxt "#30135"
|
msgctxt "#30135"
|
||||||
msgid "The movie "%s" has been added to the video library"
|
msgid "The movie "%s" has been added to the video library"
|
||||||
@@ -664,8 +664,8 @@ msgid "No connector for the server %s"
|
|||||||
msgstr "Non c'è nessun connettore per il server %s"
|
msgstr "Non c'è nessun connettore per il server %s"
|
||||||
|
|
||||||
msgctxt "#60005"
|
msgctxt "#60005"
|
||||||
msgid ""
|
msgid "Deleting all links from channel %s"
|
||||||
msgstr ""
|
msgstr "Eliminando tutti i link del canale %s"
|
||||||
|
|
||||||
msgctxt "#60006"
|
msgctxt "#60006"
|
||||||
msgid "[B]An error has occurred in %s:[/B]"
|
msgid "[B]An error has occurred in %s:[/B]"
|
||||||
|
|||||||
+51
-43
@@ -87,8 +87,6 @@ def list_tvshows(item):
|
|||||||
|
|
||||||
|
|
||||||
def get_results(nfo_path, root, Type, local=False):
|
def get_results(nfo_path, root, Type, local=False):
|
||||||
dead_list = []
|
|
||||||
zombie_list = []
|
|
||||||
value = 0
|
value = 0
|
||||||
if Type == 'movie': folder = "folder_movies"
|
if Type == 'movie': folder = "folder_movies"
|
||||||
else: folder = "folder_tvshows"
|
else: folder = "folder_tvshows"
|
||||||
@@ -107,40 +105,6 @@ def get_results(nfo_path, root, Type, local=False):
|
|||||||
if len(item.library_urls) > 1: multichannel = True
|
if len(item.library_urls) > 1: multichannel = True
|
||||||
else: multichannel = False
|
else: multichannel = False
|
||||||
|
|
||||||
# Verify the existence of the channels. If the channel does not exist, ask yourself if you want to remove the links from that channel.
|
|
||||||
|
|
||||||
for canal in item.library_urls:
|
|
||||||
try:
|
|
||||||
if canal in ['community', 'downloads']: channel_verify = __import__('specials.%s' % canal, fromlist=["channels.%s" % canal])
|
|
||||||
else: channel_verify = __import__('channels.%s' % canal, fromlist=["channels.%s" % canal])
|
|
||||||
logger.debug('Channel %s seems correct' % channel_verify)
|
|
||||||
except:
|
|
||||||
dead_item = Item(multichannel=multichannel,
|
|
||||||
contentType='tvshow',
|
|
||||||
dead=canal,
|
|
||||||
path=filetools.split(nfo_path)[0],
|
|
||||||
nfo=nfo_path,
|
|
||||||
library_urls=item.library_urls,
|
|
||||||
infoLabels={'title': item.contentTitle})
|
|
||||||
|
|
||||||
if canal not in dead_list and canal not in zombie_list: confirm = platformtools.dialog_yesno(config.get_localized_string(30131), config.get_localized_string(30132) % canal.upper() + '\n' + config.get_localized_string(30133))
|
|
||||||
elif canal in zombie_list: confirm = False
|
|
||||||
else: confirm = True
|
|
||||||
|
|
||||||
if confirm:
|
|
||||||
delete(dead_item)
|
|
||||||
if canal not in dead_list:
|
|
||||||
dead_list.append(canal)
|
|
||||||
continue
|
|
||||||
else:
|
|
||||||
if canal not in zombie_list:
|
|
||||||
zombie_list.append(canal)
|
|
||||||
|
|
||||||
if len(dead_list) > 0:
|
|
||||||
for canal in dead_list:
|
|
||||||
if canal in item.library_urls:
|
|
||||||
del item.library_urls[canal]
|
|
||||||
|
|
||||||
# continue loading the elements of the video library
|
# continue loading the elements of the video library
|
||||||
if Type == 'movie':
|
if Type == 'movie':
|
||||||
item.path = filetools.split(nfo_path)[0]
|
item.path = filetools.split(nfo_path)[0]
|
||||||
@@ -377,6 +341,8 @@ def get_episodes(item):
|
|||||||
|
|
||||||
def findvideos(item):
|
def findvideos(item):
|
||||||
from core import autoplay
|
from core import autoplay
|
||||||
|
from platformcode import platformtools
|
||||||
|
|
||||||
logger.debug()
|
logger.debug()
|
||||||
# logger.debug("item:\n" + item.tostring('\n'))
|
# logger.debug("item:\n" + item.tostring('\n'))
|
||||||
videolibrarytools.check_renumber_options(item)
|
videolibrarytools.check_renumber_options(item)
|
||||||
@@ -436,7 +402,6 @@ def findvideos(item):
|
|||||||
if item_local:
|
if item_local:
|
||||||
opciones.append(item_local.title)
|
opciones.append(item_local.title)
|
||||||
|
|
||||||
from platformcode import platformtools
|
|
||||||
index = platformtools.dialog_select(config.get_localized_string(30163), opciones)
|
index = platformtools.dialog_select(config.get_localized_string(30163), opciones)
|
||||||
if index < 0:
|
if index < 0:
|
||||||
return []
|
return []
|
||||||
@@ -449,6 +414,7 @@ def findvideos(item):
|
|||||||
filtro_canal = opciones[index].replace(config.get_localized_string(70078), "").strip()
|
filtro_canal = opciones[index].replace(config.get_localized_string(70078), "").strip()
|
||||||
itemlist = []
|
itemlist = []
|
||||||
|
|
||||||
|
all_videolibrary = []
|
||||||
for nom_canal, json_path in list(list_canales.items()):
|
for nom_canal, json_path in list(list_canales.items()):
|
||||||
if filtro_canal and filtro_canal != nom_canal.capitalize():
|
if filtro_canal and filtro_canal != nom_canal.capitalize():
|
||||||
continue
|
continue
|
||||||
@@ -463,6 +429,50 @@ def findvideos(item):
|
|||||||
channel = __import__('channels.%s' % nom_canal, fromlist=["channels.%s" % nom_canal])
|
channel = __import__('channels.%s' % nom_canal, fromlist=["channels.%s" % nom_canal])
|
||||||
except ImportError:
|
except ImportError:
|
||||||
exec("import channels." + nom_canal + " as channel")
|
exec("import channels." + nom_canal + " as channel")
|
||||||
|
except:
|
||||||
|
dead_list = []
|
||||||
|
zombie_list = []
|
||||||
|
|
||||||
|
if nom_canal not in dead_list and nom_canal not in zombie_list: confirm = platformtools.dialog_yesno(config.get_localized_string(30131), config.get_localized_string(30132) % nom_canal.upper() + '\n' + config.get_localized_string(30133))
|
||||||
|
elif nom_canal in zombie_list: confirm = False
|
||||||
|
else: confirm = True
|
||||||
|
|
||||||
|
if confirm:
|
||||||
|
# delete the channel from all movie and tvshow
|
||||||
|
from past.utils import old_div
|
||||||
|
num_enlaces = 0
|
||||||
|
dialog = platformtools.dialog_progress(config.get_localized_string(30131), config.get_localized_string(60005) % nom_canal)
|
||||||
|
if not all_videolibrary:
|
||||||
|
all_videolibrary = list_movies(Item()) + list_tvshows(Item())
|
||||||
|
for n, it in enumerate(all_videolibrary):
|
||||||
|
if nom_canal in it.library_urls:
|
||||||
|
dead_item = Item(multichannel=len(item.library_urls) > 1,
|
||||||
|
contentType=it.contentType,
|
||||||
|
dead=nom_canal,
|
||||||
|
path=filetools.split(it.nfo)[0],
|
||||||
|
nfo=it.nfo,
|
||||||
|
library_urls=it.library_urls,
|
||||||
|
infoLabels={'title': it.contentTitle})
|
||||||
|
num_enlaces += delete(dead_item)
|
||||||
|
dialog.update(old_div(100*n, len(all_videolibrary)))
|
||||||
|
|
||||||
|
dialog.close()
|
||||||
|
msg_txt = config.get_localized_string(70087) % (num_enlaces, nom_canal)
|
||||||
|
logger.info(msg_txt)
|
||||||
|
platformtools.dialog_notification(config.get_localized_string(30131), msg_txt)
|
||||||
|
platformtools.itemlist_refresh()
|
||||||
|
|
||||||
|
if nom_canal not in dead_list:
|
||||||
|
dead_list.append(nom_canal)
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
if nom_canal not in zombie_list:
|
||||||
|
zombie_list.append(nom_canal)
|
||||||
|
|
||||||
|
if len(dead_list) > 0:
|
||||||
|
for nom_canal in dead_list:
|
||||||
|
if nom_canal in item.library_urls:
|
||||||
|
del item.library_urls[nom_canal]
|
||||||
|
|
||||||
item_json = Item().fromjson(filetools.read(json_path))
|
item_json = Item().fromjson(filetools.read(json_path))
|
||||||
list_servers = []
|
list_servers = []
|
||||||
@@ -1048,15 +1058,13 @@ def delete(item):
|
|||||||
if item_nfo.emergency_urls and item_nfo.emergency_urls.get(canal, False):
|
if item_nfo.emergency_urls and item_nfo.emergency_urls.get(canal, False):
|
||||||
del item_nfo.emergency_urls[canal]
|
del item_nfo.emergency_urls[canal]
|
||||||
filetools.write(item.nfo, head_nfo + item_nfo.tojson())
|
filetools.write(item.nfo, head_nfo + item_nfo.tojson())
|
||||||
|
return num_enlaces
|
||||||
msg_txt = config.get_localized_string(70087) % (num_enlaces, canal)
|
|
||||||
logger.info(msg_txt)
|
|
||||||
platformtools.dialog_notification(heading, msg_txt)
|
|
||||||
platformtools.itemlist_refresh()
|
|
||||||
|
|
||||||
else:
|
else:
|
||||||
if platformtools.dialog_yesno(heading, config.get_localized_string(70088) % item.infoLabels['title']):
|
if platformtools.dialog_yesno(heading, config.get_localized_string(70088) % item.infoLabels['title']):
|
||||||
delete_all(item)
|
delete_all(item)
|
||||||
|
return 1
|
||||||
|
else:
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
def check_season_playcount(item, season):
|
def check_season_playcount(item, season):
|
||||||
|
|||||||
Reference in New Issue
Block a user