From d37babe2fe13ec8c8953c36af93ca67b3eb74db6 Mon Sep 17 00:00:00 2001 From: Alhaziel Date: Tue, 16 Apr 2019 12:32:03 +0200 Subject: [PATCH 1/8] Auto-Renumeration + Test in Anime World^C --- plugin.video.alfa/channels/animeworld.py | 28 ++-- plugin.video.alfa/channels/autorenumber.py | 136 ++++++++++++++++++ .../resources/language/Catalan/strings.po | 18 ++- .../resources/language/English/strings.po | 8 ++ .../resources/language/Italian/strings.po | 10 +- .../language/Spanish (Argentina)/strings.po | 14 +- .../language/Spanish (Mexico)/strings.po | 14 +- .../resources/language/Spanish/strings.po | 14 +- 8 files changed, 218 insertions(+), 24 deletions(-) create mode 100644 plugin.video.alfa/channels/autorenumber.py diff --git a/plugin.video.alfa/channels/animeworld.py b/plugin.video.alfa/channels/animeworld.py index f811f030..34314cfd 100644 --- a/plugin.video.alfa/channels/animeworld.py +++ b/plugin.video.alfa/channels/animeworld.py @@ -4,10 +4,10 @@ # ---------------------------------------------------------- import re, urlparse -from core import httptools, scrapertoolsV2, servertools, tmdb +from core import httptools, scrapertoolsV2, servertools, tmdb, tvdb from core.item import Item from platformcode import logger, config -from channels import autoplay, filtertools, support +from channels import autoplay, filtertools, support, autorenumber from channelselector import thumb @@ -214,7 +214,8 @@ def lista_anime(item): plot=scrapedplot, folder=True)) - tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) + tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) + autorenumber.renumber(itemlist) # Next page next_page = scrapertoolsV2.find_single_match(data, '
  • ([^<]+)' + if 'Successivo>>' in itemlist[-1].title: + itemlist.pop() - matches = re.compile(patron, re.DOTALL).findall(data) - - for scrapedurl, scrapedtitle in matches: - itemlist.append( - Item(channel=item.channel, - action="fichas", - title=scrapedtitle, - url=scrapedurl)) - - # Elimina 'voci dal menu' de la lista de 'sottomenu' - itemlist.pop(0) - itemlist.pop(0) - itemlist.pop(0) - itemlist.pop(28) + # Continua la ricerca in caso di errore + except: + import sys + for line in sys.exc_info(): + logger.error("{0}".format(line)) + return [] return itemlist + +def genre(item): + itemlist = support.scrape(item, '([^<]+)', ['url', 'title'], headers,['Serie TV','Serie TV Americane','Serie TV Italiane','altadefinizione'], action='peliculas') + return thumb(itemlist) + + def nation(item): - itemlist = [Item(channel=item.channel, - action="fichas", - title="Serie TV Americane", - url=host+'/serie-tv-streaming/serie-tv-americane/'), - Item(channel=item.channel, - action="fichas", - title="Serie TV Italiane", - url=host+'/serie-tv-streaming/serie-tv-italiane/')] - # auto thumb - itemlist=thumb(itemlist) - - return itemlist - -def fichas(item): - logger.info("[seriehd.py] fichas") + log() itemlist = [] - - data = httptools.downloadpage(item.url).data - - patron = r'

    (.*?)

    \s*' - patron += r'[^\s*' - patron += '' - - matches = re.compile(patron, re.DOTALL).findall(data) - - for scrapedtitle, scrapedthumbnail, scrapedurl in matches: - scrapedthumbnail = httptools.get_url_headers(scrapedthumbnail) - scrapedtitle = scrapertools.decodeHtmlentities(scrapedtitle).strip() - itemlist.append( - Item(channel=item.channel, - action="episodios", - title="[COLOR azure]" + scrapedtitle + "[/COLOR]", - fulltitle=scrapedtitle, - url=scrapedurl, - show=scrapedtitle, - thumbnail=scrapedthumbnail)) - - patron = r"\d+\d+" - next_page = scrapertools.find_single_match(data, patron) - if next_page != "": - itemlist.append( - Item(channel=item.channel, - action="fichas", - title="[COLOR blue]" + config.get_localized_string(30992) + "[/COLOR]", - url=next_page, - thumbnali=thumb())) - - tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) + menu(itemlist, 'Serie TV Americane', 'peliculas', host + '/serie-tv-streaming/serie-tv-americane/') + menu(itemlist, 'Serie TV Italiane', 'peliculas', host + '/serie-tv-streaming/serie-tv-italiane/') return itemlist +def peliculas(item): + return support.scrape(item,r'

    (.*?)

    \s*[^\s*',['title', 'thumb', 'url'], headers, patronNext=r"\d+\d+", action='episodios') + def episodios(item): - logger.info("[seriehd.py] episodios") + log() itemlist = [] data = httptools.downloadpage(item.url).data - patron = r'' - matches = re.compile(patron, re.DOTALL).findall(data) - - for option, scrapedurl in matches: - scrapedurl = scrapedurl.replace('"','').replace('&','&') - data_video = get_source(scrapedurl) - url = scrapertools.find_single_match(data_video, '
    .*?src="([^"]+)" frameborder') - opt_data = scrapertools.find_single_match(data,'"%s">.*?.*?(.*?)'%option).split('-') - language = opt_data[0].strip() - language = re.sub('\(|\)', '', language) - quality = opt_data[1].strip() - if url != '' and 'youtube' not in url: - itemlist.append(Item(channel=item.channel, title='%s', url=url, language=IDIOMAS[language], quality=quality, - action='play', infoLabels=item.infoLabels)) - elif 'youtube' in url: - trailer = Item(channel=item.channel, title='Trailer', url=url, action='play', server='youtube') - - itemlist = servertools.get_servers_itemlist(itemlist, lambda i: i.title % '%s [%s] [%s]'%(i.server.capitalize(), - i.language, i.quality)) - try: - itemlist.append(trailer) - except: - pass - - # Requerido para FilterTools - itemlist = filtertools.get_links(itemlist, item, list_language) - - # Requerido para AutoPlay - - autoplay.start(itemlist, item) - - if config.get_videolibrary_support() and len(itemlist) > 0 and item.extra != 'findvideos': - itemlist.append( - Item(channel=item.channel, title='[COLOR yellow]Añadir esta pelicula a la videoteca[/COLOR]', url=item.url, - action="add_pelicula_to_library", extra="findvideos", contentTitle=item.contentTitle)) - - - return itemlist - - -def search(item, texto): - logger.info() - texto = texto.replace(" ", "+") - item.url = item.url + texto - item.section = 'search' - if texto != '': - return list_all(item) - else: - return [] - - -def newest(categoria): - logger.info() - itemlist = [] - item = Item() - try: - if categoria in ['peliculas','latino']: - item.url = host - elif categoria == 'infantiles': - item.url = host+'animacion/?tr_post_type=1' - elif categoria == 'terror': - item.url = host+'terror/?tr_post_type=1' - item.type = 'MovieList' - item.section = 'search' - itemlist = list_all(item) - if itemlist[-1].title == 'Siguiente >>': - itemlist.pop() - except: - import sys - for line in sys.exc_info(): - logger.error("{0}".format(line)) - return [] - - return itemlist diff --git a/plugin.video.alfa/channels/cinefox.json b/plugin.video.alfa/channels/cinefox.json deleted file mode 100755 index 0f744bbe..00000000 --- a/plugin.video.alfa/channels/cinefox.json +++ /dev/null @@ -1,173 +0,0 @@ -{ - "id": "cinefox", - "name": "Cinefox", - "active": true, - "adult": false, - "language": ["esp", "lat", "cast"], - "thumbnail": "cinefox.png", - "banner": "cinefox.png", - "categories": [ - "movie", - "tvshow", - "vos" - ], - "settings": [ - { - "id": "include_in_global_search", - "type": "bool", - "label": "Incluir en busqueda global", - "default": true, - "enabled": true, - "visible": true - }, - { - "id": "filter_languages", - "type": "list", - "label": "Mostrar enlaces en idioma...", - "default": 0, - "enabled": true, - "visible": true, - "lvalues": [ - "No filtrar", - "LAT", - "CAST", - "VOSE", - "VO" - ] - }, - { - "id": "save_last_search", - "type": "bool", - "label": "Guardar última búsqueda", - "default": true, - "enabled": true, - "visible": true - }, - { - "id": "include_in_newest_peliculas", - "type": "bool", - "label": "Incluir en Novedades - Películas", - "default": true, - "enabled": true, - "visible": true - }, - { - "id": "include_in_newest_series", - "type": "bool", - "label": "Incluir en Novedades - Series", - "default": true, - "enabled": true, - "visible": true - }, - { - "id": "modo_grafico", - "type": "bool", - "label": "Buscar información extra", - "default": true, - "enabled": true, - "visible": true - }, - { - "id": "comprueba_enlaces", - "type": "bool", - "label": "Verificar si los enlaces existen", - "default": false, - "enabled": true, - "visible": true - }, - { - "id": "comprueba_enlaces_num", - "type": "list", - "label": "Número de enlaces a verificar", - "default": 1, - "enabled": true, - "visible": "eq(-1,true)", - "lvalues": [ "5", "10", "15", "20" ] - }, - { - "id": "perfil", - "type": "list", - "label": "Perfil de color", - "default": 2, - "enabled": true, - "visible": true, - "lvalues": [ - "Perfil 3", - "Perfil 2", - "Perfil 1", - "Ninguno" - ] - }, - { - "id": "menu_info", - "type": "bool", - "label": "Mostrar menú intermedio película/episodio", - "default": false, - "enabled": false, - "visible": false - }, - { - "id": "last_page", - "type": "bool", - "label": "Ocultar opción elegir página en películas (Kodi)", - "default": false, - "enabled": true, - "visible": true - }, - { - "id": "filtro_defecto_peliculas", - "type": "label", - "enabled": true, - "visible": false - }, - { - "id": "pers_peliculas1", - "type": "label", - "enabled": true, - "visible": false - }, - { - "id": "pers_peliculas2", - "type": "label", - "enabled": true, - "visible": false - }, - { - "pers_peliculas3": { - "type": "label", - "enabled": true, - "visible": false - } - }, - { - "id": "filtro_defecto_series", - "type": "label", - "enabled": true, - "visible": false - }, - { - "id": "pers_series1", - "type": "label", - "enabled": true, - "visible": false - }, - { - "id": "pers_series2", - "type": "label", - "enabled": true, - "visible": false - }, - { - "id": "pers_series3", - "type": "label", - "enabled": true, - "visible": false - }, - { - "id": "last_search", - "type": "text", - "enabled": true, - "visible": false - } - ] -} diff --git a/plugin.video.alfa/channels/cinefox.py b/plugin.video.alfa/channels/cinefox.py deleted file mode 100644 index 3fabca96..00000000 --- a/plugin.video.alfa/channels/cinefox.py +++ /dev/null @@ -1,804 +0,0 @@ -# -*- coding: utf-8 -*- - -import re -import urlparse - -from core import httptools -from core import jsontools -from core import scrapertools -from core import servertools -from core import tmdb -from core.item import Item -from platformcode import config, logger -from channelselector import get_thumb -from channels import autoplay -from channels import filtertools - - -IDIOMAS = {'Latino': 'LAT', 'Castellano':'CAST', 'Vo':'VO', 'Vose': 'VOSE'} -list_language = IDIOMAS.values() -list_quality = [] -list_servers = ['openload', 'powvideo', 'rapidvideo', 'streamango', 'streamcloud', 'flashx', 'gamovideo', 'streamplay'] - - - -__modo_grafico__ = config.get_setting('modo_grafico', 'cinefox') -__perfil__ = int(config.get_setting('perfil', "cinefox")) -__menu_info__ = config.get_setting('menu_info', 'cinefox') -__comprueba_enlaces__ = config.get_setting('comprueba_enlaces', 'cinefox') -__comprueba_enlaces_num__ = config.get_setting('comprueba_enlaces_num', 'cinefox') - -# Fijar perfil de color -perfil = [['0xFFFFE6CC', '0xFFFFCE9C', '0xFF994D00', '0xFFFE2E2E', '0xFF088A08'], - ['0xFFA5F6AF', '0xFF5FDA6D', '0xFF11811E', '0xFFFE2E2E', '0xFF088A08'], - ['0xFF58D3F7', '0xFF2E9AFE', '0xFF2E64FE', '0xFFFE2E2E', '0xFF088A08']] -if __perfil__ < 3: - color1, color2, color3, color4, color5 = perfil[__perfil__] -else: - color1 = color2 = color3 = color4 = color5 = "" - - - -host = "http://www.cinefox.tv" - - -def mainlist(item): - logger.info() - item.text_color = color1 - itemlist = [] - - autoplay.init(item.channel, list_servers, list_quality) - - itemlist.append(item.clone(action="seccion_peliculas", title="Películas", fanart="http://i.imgur.com/PjJaW8o.png", - url=host + "/catalogue?type=peliculas", thumbnail=get_thumb('movies', auto=True))) - # Seccion series - itemlist.append(item.clone(action="seccion_series", title="Series", - url=host + "/ultimos-capitulos", fanart="http://i.imgur.com/9loVksV.png", - thumbnail=get_thumb('tvshows', auto=True))) - - itemlist.append(item.clone(action="peliculas", title="Documentales", fanart="http://i.imgur.com/Q7fsFI6.png", - url=host + "/catalogue?type=peliculas&genre=documental", - thumbnail=get_thumb('documentaries', auto=True))) - - if config.get_setting("adult_mode") != 0: - itemlist.append(item.clone(action="peliculas", title="Sección Adultos +18", - url=host + "/catalogue?type=adultos", - fanart="http://i.imgur.com/kIvE1Zh.png", thumbnail=get_thumb('adults', auto=True))) - - itemlist.append(item.clone(title="Buscar...", action="local_search", thumbnail=get_thumb('search', auto=True))) - itemlist.append(item.clone(title="Configurar canal...", text_color="gold", action="configuracion", folder=False)) - - autoplay.show_option(item.channel, itemlist) - - return itemlist - - -def configuracion(item): - from platformcode import platformtools - ret = platformtools.show_channel_settings() - platformtools.itemlist_refresh() - return ret - - -def search(item, texto): - logger.info() - texto = texto.replace(" ", "+") - item.url = host + "/search?q=%s" % texto - try: - return busqueda(item) - # Se captura la excepción, para no interrumpir al buscador global si un canal falla - except: - import sys - for line in sys.exc_info(): - logger.error("%s" % line) - return [] - - -def local_search(item): - logger.info() - text = "" - if config.get_setting("save_last_search", item.channel): - text = config.get_setting("last_search", item.channel) - from platformcode import platformtools - texto = platformtools.dialog_input(default=text, heading="Buscar en Cinefox") - if texto is None: - return - - if config.get_setting("save_last_search", item.channel): - config.set_setting("last_search", texto, item.channel) - - return search(item, texto) - - -def busqueda(item): - logger.info() - itemlist = [] - - data = httptools.downloadpage(item.url).data - patron = '
    (.*?)(?:
  • |