diff --git a/plugin.video.alfa/addon.xml b/plugin.video.alfa/addon.xml
index b52b014b..b4686abb 100755
--- a/plugin.video.alfa/addon.xml
+++ b/plugin.video.alfa/addon.xml
@@ -1,5 +1,5 @@
-([^"]+)<\/h1>'
genero = scrapertools.find_single_match(data, patron_genero)
@@ -118,9 +121,7 @@ def lista(item):
patron = "Siguiente "
else:
patron = ".+?href='(.+?)'>"
-
next_page_url = scrapertools.find_single_match(data, patron)
-
if next_page_url != "":
item.url = next_page_url
itemlist.append(Item(channel=item.channel, action="lista", title="[COLOR cyan]Página Siguiente >>[/COLOR]", url=next_page_url,
@@ -130,22 +131,34 @@ def lista(item):
def findvideos(item):
logger.info()
-
itemlist = []
itemlist1 = []
-
data = httptools.downloadpage(item.url).data
itemlist1.extend(servertools.find_video_items(data=data))
patron_show = '
([^<]+)<\/h1>'
show = scrapertools.find_single_match(data, patron_show)
for videoitem in itemlist1:
videoitem.channel = item.channel
+ videoitem.infoLabels = item.infoLabels
for i in range(len(itemlist1)):
if not 'youtube' in itemlist1[i].title:
itemlist.append(itemlist1[i])
+ tmdb.set_infoLabels(itemlist, True)
+ # 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.contentChannel!='videolibrary':
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=show))
-
return itemlist
+
+
+def play(item):
+ logger.info()
+ item.thumbnail = item.contentThumbnail
+ return [item]
diff --git a/plugin.video.alfa/channels/documaniatv.json b/plugin.video.alfa/channels/documaniatv.json
new file mode 100644
index 00000000..3cdda230
--- /dev/null
+++ b/plugin.video.alfa/channels/documaniatv.json
@@ -0,0 +1,79 @@
+{
+ "id": "documaniatv",
+ "name": "DocumaniaTV",
+ "active": true,
+ "adult": false,
+ "language": ["cast"],
+ "banner": "",
+ "thumbnail": "https://www.documaniatv.com/uploads/xcustom-logo.png.pagespeed.ic.lxJKR_lQE9.webp",
+ "version": 1,
+ "categories": [
+ "documentary",
+ "vos",
+ "direct",
+ "torrent"
+ ],
+ "settings": [
+ {
+ "id": "include_in_global_search",
+ "type": "bool",
+ "label": "Incluir en busqueda global",
+ "default": true,
+ "enabled": true,
+ "visible": true
+ },
+ {
+ "id": "modo_grafico",
+ "type": "bool",
+ "label": "Buscar información extra",
+ "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",
+ "CAST",
+ "LAT",
+ "VO",
+ "VOS",
+ "VOSE"
+ ]
+ },
+ {
+ "id": "timeout_downloadpage",
+ "type": "list",
+ "label": "Timeout (segs.) en descarga de páginas o verificación de servidores",
+ "default": 5,
+ "enabled": true,
+ "visible": true,
+ "lvalues": [
+ "None",
+ "1",
+ "2",
+ "3",
+ "4",
+ "5",
+ "6",
+ "7",
+ "8",
+ "9",
+ "10"
+ ]
+ },
+ {
+ "id": "include_in_newest_documentales",
+ "type": "bool",
+ "label": "Incluir en Novedades - Documentales",
+ "default": true,
+ "enabled": true,
+ "visible": true
+ }
+ ]
+}
diff --git a/plugin.video.alfa/channels/documaniatv.py b/plugin.video.alfa/channels/documaniatv.py
new file mode 100644
index 00000000..05603135
--- /dev/null
+++ b/plugin.video.alfa/channels/documaniatv.py
@@ -0,0 +1,792 @@
+# -*- coding: utf-8 -*-
+
+import re
+import sys
+import urllib
+import urlparse
+import time
+
+from channelselector import get_thumb
+from core import httptools
+from core import scrapertools
+from core import servertools
+from core.item import Item
+from platformcode import config, logger
+from core import tmdb
+from lib import generictools
+from channels import filtertools
+from channels import autoplay
+
+
+#IDIOMAS = {'CAST': 'Castellano', 'LAT': 'Latino', 'VO': 'Version Original'}
+IDIOMAS = {'Castellano': 'CAST', 'Latino': 'LAT', 'Version Original': 'VO'}
+list_language = IDIOMAS.values()
+list_quality = []
+list_servers = ['directo']
+
+
+host = 'https://www.documaniatv.com/'
+channel = "documaniatv"
+
+categoria = channel.capitalize()
+__modo_grafico__ = config.get_setting('modo_grafico', channel)
+timeout = config.get_setting('timeout_downloadpage', channel)
+
+
+def mainlist(item):
+ logger.info()
+ itemlist = []
+
+ thumb_docus = get_thumb("channels_documentary.png")
+ thumb_series = get_thumb("channels_tvshow.png")
+ thumb_buscar = get_thumb("search.png")
+ thumb_separador = get_thumb("next.png")
+ thumb_settings = get_thumb("setting_0.png")
+ thumb_cartelera = get_thumb("now_playing.png")
+ thumb_pelis_vos = get_thumb("channels_vos.png")
+ thumb_popular = get_thumb("popular.png")
+ thumb_generos = get_thumb("genres.png")
+
+ autoplay.init(item.channel, list_servers, list_quality)
+
+ itemlist.append(Item(channel=item.channel, title="Novedades", action="listado", url=host + "newvideos.html", thumbnail=thumb_docus, extra="novedades"))
+ itemlist.append(Item(channel=item.channel, title="Los Más Vistos", action="listado", url=host + "topvideos.html", thumbnail=thumb_popular, extra="populares"))
+ itemlist.append(Item(channel=item.channel, title="Por Géneros", action="categorias", url=host + "categorias-y-canales.html", thumbnail=thumb_generos, extra="categorias"))
+ itemlist.append(Item(channel=item.channel, title="Series", action="listado", url=host + "top-series-documentales.html", thumbnail=thumb_series, extra="series"))
+
+ itemlist.append(Item(channel=item.channel, title="Buscar...", action="search", url=host + "search.php?keywords=", thumbnail=thumb_buscar, extra="search"))
+
+ itemlist.append(Item(channel=item.channel, url=host, title="[COLOR yellow]Configuración:[/COLOR]", folder=False, thumbnail=thumb_separador))
+
+ itemlist.append(Item(channel=item.channel, action="configuracion", title="Configurar canal", thumbnail=thumb_settings))
+
+ autoplay.show_option(item.channel, itemlist) #Activamos Autoplay
+
+ return itemlist
+
+def configuracion(item):
+ from platformcode import platformtools
+ ret = platformtools.show_channel_settings()
+ platformtools.itemlist_refresh()
+ return
+
+
+def categorias(item):
+ logger.info()
+
+ itemlist = []
+
+ data = ''
+ try:
+ data = re.sub(r"\n|\r|\t|\s{2}|()", "", httptools.downloadpage(item.url, timeout=timeout).data)
+ data = unicode(data, "utf-8", errors="replace").encode("utf-8")
+ except:
+ pass
+
+ patron = ''
+ #Verificamos si se ha cargado una página, y si además tiene la estructura correcta
+ if not data or not scrapertools.find_single_match(data, patron):
+ item = generictools.web_intervenida(item, data) #Verificamos que no haya sido clausurada
+ if item.intervencion: #Sí ha sido clausurada judicialmente
+ for clone_inter, autoridad in item.intervencion:
+ thumb_intervenido = get_thumb(autoridad)
+ itemlist.append(item.clone(action='', title="[COLOR yellow]" + clone_inter.capitalize() + ': [/COLOR]' + intervenido_judicial + '. Reportar el problema en el foro', thumbnail=thumb_intervenido))
+ return itemlist #Salimos
+
+ logger.error("ERROR 01: SUBMENU: La Web no responde o ha cambiado de URL: " + item.url + data)
+ if not data: #Si no ha logrado encontrar nada, salimos
+ itemlist.append(item.clone(action='', title=item.category + ': ERROR 01: SUBMENU: La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log'))
+ return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
+
+ matches = re.compile(patron, re.DOTALL).findall(data)
+
+ if not matches:
+ logger.error("ERROR 02: SUBMENU: Ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data)
+ itemlist.append(item.clone(action='', title=item.category + ': ERROR 02: SUBMENU: Ha cambiado la estructura de la Web. Reportar el error con el log'))
+ return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos
+
+ #logger.debug(matches)
+
+ for scrapedurl, scrapedtitle in matches:
+ if 'series documentales' in scrapedtitle.lower():
+ continue
+ itemlist.append(item.clone(action="listado", title=scrapedtitle.capitalize().strip(), url=scrapedurl))
+
+ return itemlist
+
+
+def listado(item):
+ logger.info()
+ itemlist = []
+ item.category = categoria
+
+ #logger.debug(item)
+
+ curr_page = 1 # Página inicial Web
+ curr_page_foot = 1 # Página inicial Alfa
+ last_page = 99999 # Última página inicial
+ last_page_foot = 1 # Última página inicial
+ cnt_tot = 40 # Poner el num. máximo de items por página
+ cnt_title = 0 # Contador de líneas insertadas en Itemlist
+ cnt_title_tot = 0 # Contador de líneas insertadas en Itemlist, total
+ if item.curr_page:
+ curr_page = int(item.curr_page) # Si viene de una pasada anterior, lo usamos
+ del item.curr_page # ... y lo borramos
+ if item.curr_page_foot:
+ curr_page_foot = int(item.curr_page_foot) # Si viene de una pasada anterior, lo usamos
+ del item.curr_page_foot # ... y lo borramos
+ if item.last_page:
+ last_page = int(item.last_page) # Si viene de una pasada anterior, lo usamos
+ del item.last_page # ... y lo borramos
+ if item.last_page_foot:
+ last_page_foot = int(item.last_page_foot) # Si viene de una pasada anterior, lo usamos
+ del item.last_page_foot # ... y lo borramos
+ if item.cnt_tot:
+ cnt_tot = int(item.cnt_tot) # Si viene de una pasada anterior, lo usamos
+ del item.cnt_tot # ... y lo borramos
+ if item.cnt_title_tot:
+ cnt_title_tot = int(item.cnt_title_tot) # Si viene de una pasada anterior, lo usamos
+ del item.cnt_title_tot # ... y lo borramos
+
+ inicio = time.time() # Controlaremos que el proceso no exceda de un tiempo razonable
+ fin = inicio + 10 # Después de este tiempo pintamos (segundos)
+ timeout_search = timeout # Timeout para descargas
+ if item.extra == 'search':
+ timeout_search = timeout * 2 # Timeout un poco más largo para las búsquedas
+ if timeout_search < 5:
+ timeout_search = 5 # Timeout un poco más largo para las búsquedas
+
+ if not item.extra2: # Si viene de Catálogo o de Alfabeto
+ item.extra2 = ''
+
+ next_page_url = item.url
+ #Máximo num. de líneas permitidas por TMDB. Máx de 10 segundos por Itemlist para no degradar el rendimiento
+ while cnt_title < cnt_tot and curr_page <= last_page and fin > time.time():
+
+ # Descarga la página
+ data = ''
+ try:
+ data = re.sub(r"\n|\r|\t|\s{2}|()| ", "", httptools.downloadpage(next_page_url, timeout=timeout_search).data)
+ data = unicode(data, "utf-8", errors="replace").encode("utf-8")
+ except:
+ pass
+
+ if not data: #Si la web está caída salimos sin dar error
+ logger.error("ERROR 01: LISTADO: La Web no responde o ha cambiado de URL: " + item.url + " / DATA: " + data)
+ itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: LISTADO:. La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log'))
+ break #si no hay más datos, algo no funciona, pintamos lo que tenemos
+
+ #Patrón para todo, menos para Series
+ patron = '(.*?)<\/span>.*?.*?data-echo="([^"]+)"'
+
+ #Si viene de Series, ponemos un patrón especializado
+ if item.extra == 'series':
+ patron = '(?:(.*?)<\/span>.*?)?.*?
cnt_title_tot and cnt_title_tot > 0:
+ matches = matches[cnt_title_tot:]
+
+ #logger.debug("PATRON: " + patron)
+ #logger.debug(matches)
+ #logger.debug(data)
+
+ #Buscamos la url de paginado y la última página
+ data_page = scrapertools.find_single_match(data, '
.*?<\/li><\/ul><\/div><\/div> <\/div>')
+ if item.extra == 'series':
+ patron = '>(\d+)?<\/a><\/li>