diff --git a/core/support.py b/core/support.py index c4502460..b06a6dab 100755 --- a/core/support.py +++ b/core/support.py @@ -453,14 +453,14 @@ def scrape(func): if anime: if function == 'episodios' or item.action == 'episodios': autorenumber.renumber(itemlist, item, 'bold') else: autorenumber.renumber(itemlist) - if anime and autorenumber.check(item) == False and len(itemlist)>0 and not scrapertools.find_single_match(itemlist[0].title, r'(\d+.\d+)'): - pass - else: - if addVideolibrary and (item.infoLabels["title"] or item.fulltitle): - # item.fulltitle = item.infoLabels["title"] - videolibrary(itemlist, item, function=function) - if function == 'episodios' or function == 'findvideos': - download(itemlist, item, function=function) + # if anime and autorenumber.check(item) == False and len(itemlist)>0 and not scrapertools.find_single_match(itemlist[0].title, r'(\d+.\d+)'): + # pass + # else: + if addVideolibrary and (item.infoLabels["title"] or item.fulltitle): + # item.fulltitle = item.infoLabels["title"] + videolibrary(itemlist, item, function=function) + if function == 'episodios' or function == 'findvideos': + download(itemlist, item, function=function) if 'patronMenu' in args and itemlist: itemlist = thumb(itemlist, genre=True) @@ -1008,18 +1008,18 @@ def videolibrary(itemlist, item, typography='', function_level=1, function=''): from channelselector import get_thumb itemlist.append( Item(channel=item.channel, - title=title, - fulltitle=item.fulltitle, - show=item.fulltitle, - contentType=contentType, - contentTitle=contentTitle, - contentSerieName=contentSerieName, - url=item.url, - action=action, - extra=extra, - path=item.path, - thumbnail=get_thumb('add_to_videolibrary.png') - )) + title=title, + fulltitle=item.fulltitle, + show=item.fulltitle, + contentType=contentType, + contentTitle=contentTitle, + contentSerieName=contentSerieName, + url=item.url, + action=action, + extra=extra, + path=item.path, + thumbnail=get_thumb('add_to_videolibrary.png') + )) return itemlist diff --git a/core/videolibrarytools.py b/core/videolibrarytools.py index f616bde4..1b25cc07 100644 --- a/core/videolibrarytools.py +++ b/core/videolibrarytools.py @@ -922,7 +922,7 @@ def add_tvshow(item, channel=None): else: # Esta marca es porque el item tiene algo más aparte en el atributo "extra" - item.action = item.extra + item.action = item.extra if item.extra else item.action if isinstance(item.extra, str) and "###" in item.extra: item.action = item.extra.split("###")[0] item.extra = item.extra.split("###")[1] @@ -951,7 +951,17 @@ def add_tvshow(item, channel=None): # del item.tmdb_stat #Limpiamos el status para que no se grabe en la Videoteca # Obtiene el listado de episodios + itemlist = getattr(channel, item.action)(item) + if itemlist and not scrapertools.find_single_match(itemlist[0].title, r'(\d+.\d+)'): + from specials.autorenumber import select_type, renumber, check + if not check(item): + action = item.action + select_type(item) + item.action = action + return add_tvshow(item, channel) + else: + itemlist = renumber(itemlist) global magnet_caching magnet_caching = False diff --git a/platformcode/platformtools.py b/platformcode/platformtools.py index f2699963..0a187aa0 100644 --- a/platformcode/platformtools.py +++ b/platformcode/platformtools.py @@ -775,8 +775,7 @@ def set_context_commands(item, item_url, parent_item, **kwargs): action="set_custom_start", parent=item.tourl()).tourl()))) - if (item.channel != "videolibrary" and not config.get_localized_string(70585) in str(item.context)) \ - or (item.channel != "videolibrary" and config.get_localized_string(70585) in str(item.context) and config.get_localized_string(70714) in str(item.context)): + if item.channel != "videolibrary": # Añadir Serie a la videoteca if item.action in ["episodios", "get_episodios", "get_seasons"] and item.contentSerieName: context_commands.append((config.get_localized_string(60352), "XBMC.RunPlugin(%s?%s&%s)" % @@ -785,7 +784,7 @@ def set_context_commands(item, item_url, parent_item, **kwargs): elif item.action in ["detail", "findvideos"] and item.contentType == 'movie' and item.contentTitle: context_commands.append((config.get_localized_string(60353), "XBMC.RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url, 'action=add_pelicula_to_library&from_action=' + item.action))) - + if not item.local and item.channel not in ["downloads"] and item.server != 'torrent' and parent_item.action != 'mainlist' and config.get_setting('downloadenabled'): # Descargar pelicula if item.contentType == "movie": diff --git a/specials/autorenumber.py b/specials/autorenumber.py index 63293a48..f49cc050 100644 --- a/specials/autorenumber.py +++ b/specials/autorenumber.py @@ -142,7 +142,7 @@ def semiautomatic_config_item(item): # Configurazione Semi Automatica, utile in caso la numerazione automatica fallisca tvdb.find_and_set_infoLabels(item) - item.channel = item.from_channel + item.channel = item.from_channel if item.from_channel else item.channel dict_series = load(item) title = item.fulltitle.rstrip() @@ -416,8 +416,9 @@ def make_list(itemlist, item, typography, dict_series, ID, Season, Episode, Mode addiction = 0 for item in itemlist: # Otiene Numerazione Episodi - if config.get_localized_string(30992) not in item.title: - episode = int(scrapertools.find_single_match(item.title, r'\d+')) + scraped_ep = scrapertools.find_single_match(re.sub(r'\[[^\]]+\]','',item.title), r'\d+') + if scraped_ep: + episode = int(scraped_ep) number = episode + FirstOfSeason - addiction count = number + addiction # Crea Dizionario Episodi diff --git a/specials/downloads.py b/specials/downloads.py index 39cd1d5f..602efa11 100644 --- a/specials/downloads.py +++ b/specials/downloads.py @@ -847,6 +847,14 @@ def get_episodes(item): itemlist = [] + if episodes and not scrapertools.find_single_match(episodes[0].title, r'(\d+.\d+)'): + from specials.autorenumber import select_type, renumber, check + if not check(item): + select_type(item) + return get_episodes(item) + else: + renumber(episodes, item) + # Tenemos las lista, ahora vamos a comprobar for episode in episodes: # Si partiamos de un item que ya era episodio estos datos ya están bien, no hay que modificarlos