diff --git a/plugin.video.alfa/channels/descargas2020.json b/plugin.video.alfa/channels/descargas2020.json index b6b22008..6b050955 100755 --- a/plugin.video.alfa/channels/descargas2020.json +++ b/plugin.video.alfa/channels/descargas2020.json @@ -11,7 +11,9 @@ "tvshow", "anime", "torrent", - "documentary" + "documentary", + "vos", + "direct" ], "settings": [ { @@ -22,6 +24,22 @@ "enabled": true, "visible": true }, + { + "id": "modo_grafico", + "type": "bool", + "label": "Buscar información extra (TMDB)", + "default": true, + "enabled": true, + "visible": true + }, + { + "id": "seleccionar_ult_temporadda_activa", + "type": "bool", + "label": "Seleccionar para Videoteca si estará activa solo la última Temporada", + "default": true, + "enabled": true, + "visible": true + }, { "id": "clonenewpct1_ver_enlaces_veronline", "type": "list", diff --git a/plugin.video.alfa/channels/descargas2020.py b/plugin.video.alfa/channels/descargas2020.py index 241d2456..19d1e88b 100644 --- a/plugin.video.alfa/channels/descargas2020.py +++ b/plugin.video.alfa/channels/descargas2020.py @@ -15,6 +15,12 @@ from core import tmdb host = 'http://descargas2020.com/' +item = Item() +if not item.channel: + item.channel = scrapertools.find_single_match(host, r'(\w+)\.com\/') +__modo_grafico__ = config.get_setting('modo_grafico', item.channel) +modo_ultima_temp = config.get_setting('seleccionar_ult_temporadda_activa', item.channel) + def mainlist(item): logger.info() @@ -57,7 +63,12 @@ def submenu(item): logger.info() itemlist = [] - data = re.sub(r"\n|\r|\t|\s{2}|()", "", httptools.downloadpage(item.url).data) + try: + data = re.sub(r"\n|\r|\t|\s{2}|()", "", httptools.downloadpage(item.url).data) + except: + logger.error("ERROR 01: SUBMENU: La Web no responde o ha cambiado de URL") + itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log')) + return itemlist #Algo no funciona, pintamos lo que tenemos data = unicode(data, "iso-8859-1", errors="replace").encode("utf-8") data = data.replace("'", '"').replace('/series"', '/series/"') #Compatibilidad con mispelisy.series.com @@ -68,11 +79,19 @@ def submenu(item): else: if data: data = scrapertools.get_match(data, patron) + if not data: + logger.error("ERROR 02: SUBMENU: Ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data) + itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': 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 else: - return itemlist + return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos patron = '<.*?href="([^"]+)".*?>([^>]+)' 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.channel.capitalize() + ': 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 for scrapedurl, scrapedtitle in matches: title = scrapedtitle.strip() @@ -106,6 +125,10 @@ def alfabeto(item): patron = ']+>([^>]+)' 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.channel.capitalize() + ': 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 for scrapedurl, scrapedtitle in matches: title = scrapedtitle.upper() @@ -130,7 +153,12 @@ def listado(item): if item.totalItems: del item.totalItems - data = re.sub(r"\n|\r|\t|\s{2}|()", "", httptools.downloadpage(item.url).data) + try: + data = re.sub(r"\n|\r|\t|\s{2}|()", "", httptools.downloadpage(item.url).data) + except: + logger.error("ERROR 01: LISTADO: La Web no responde o ha cambiado de 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')) + return itemlist #si no hay más datos, algo no funciona, pintamos lo que tenemos #Establecemos los valores básicos en función del tipo de contenido if item.extra == "peliculas": @@ -150,6 +178,12 @@ def listado(item): patron = '' if data: fichas = scrapertools.get_match(data, patron) + if not fichas and not '

( 0 ) Resultados encontrados ' in data: #error + logger.error("ERROR 02: LISTADO: Ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data) + itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: LISTADO: 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 + elif '

( 0 ) Resultados encontrados ' in data: #no hay vídeos + return itemlist else: return itemlist page_extra = clase @@ -157,10 +191,15 @@ def listado(item): #Scrapea los datos de cada vídeo. Título alternativo se mantiene, aunque no se usa de momento patron = '( 0 ) Resultados encontrados ' in data_alt: #error + logger.error("ERROR 02: LISTADO_BUSQUEDA: Ha cambiado la estructura de la Web " + " / PATRON: " + pattern + " / DATA: " + data_alt) + itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: LISTADO_BUSQUEDA: 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 #Ahora se hace una simulación para saber cuantas líneas podemos albergar en este Itemlist. #Se controlará cuantas páginas web se tienen que leer para rellenar la lista, sin pasarse + + title_lista_alt_for = [] #usamos está lista de urls para el FOR, luego la integramos en la del WHILE for scrapedurl, scrapedtitle, scrapedthumbnail, calidad, year, size in matches_alt: #Realiza un control de las series que se añaden, ya que el buscador devuelve episodios y no las series completas #Se analiza si la url de la serie ya se ha listado antes. Si es así, esa entrada se ignora #Cuando llega al num. máximo de entradas por página, la pinta y guarda los contadores y la lista de series + scrapedurl_alt = scrapedurl if "pelisyseries.com" in host: #Excepción para mispelisyseries.com. - scrapedurl_alt = scrapedurl scrapedurl_alt = re.sub(r'\/[c|C]ap.*?-\d+-al-\d+', '', scrapedurl_alt) #Scrapeo el capítulo para hacerlo serie scrapedurl_alt = re.sub(r'\/[c|C]ap.*?-\d+', '', scrapedurl_alt) #Scrapeo el capítulo para hacerlo serie scrapedurl_alt = re.sub(r'\/[c|C]ap.*?-', '', scrapedurl_alt) #Scrapeo el capítulo para hacerlo serie @@ -514,14 +567,12 @@ def listado_busqueda(item): if scrapedurl_alt in title_lista_alt: # si ya se ha tratado, pasamos al siguiente item continue # solo guardamos la url para series y docus - if scrapedurl in title_lista_alt: # si ya se ha tratado, pasamos al siguiente item + if scrapedurl_alt in title_lista_alt or scrapedurl_alt in title_lista_alt_for: # si ya se ha tratado, pasamos al siguiente item continue # solo guardamos la url para series y docus if ".com/serie" in scrapedurl or "/serie" in scrapedurl or "-serie" in scrapedurl or "varios/" in scrapedurl: - if "pelisyseries.com" in host: - title_lista_alt += [scrapedurl_alt] - else: - title_lista_alt += [scrapedurl] + title_lista_alt_for += [scrapedurl_alt] + if "juego/" in scrapedurl: # no mostramos lo que no sean videos continue cnt_title += 1 # Sería una línea real más para Itemlist @@ -537,6 +588,7 @@ def listado_busqueda(item): if cnt_title <= cnt_tot: matches.extend(matches_alt) #Acumulamos las entradas a tratar. Si nos hemos pasado ignoro última página + title_lista_alt.extend(title_lista_alt_for) #logger.debug("PATRON: " + pattern) #logger.debug(matches) @@ -811,7 +863,7 @@ def listado_busqueda(item): return itemlist #Retornamos sin pasar por la fase de maquillaje para ahorra tiempo #Pasamos a TMDB la lista completa Itemlist - tmdb.set_infoLabels(itemlist, True) + tmdb.set_infoLabels(itemlist, __modo_grafico__) # Pasada para maquillaje de los títulos obtenidos desde TMDB for item_local in itemlist: @@ -884,6 +936,8 @@ def findvideos(item): logger.info() itemlist = [] + logger.debug(item) + # Cualquiera de las tres opciones son válidas # item.url = item.url.replace(".com/",".com/ver-online/") # item.url = item.url.replace(".com/",".com/descarga-directa/") @@ -970,14 +1024,14 @@ def findvideos(item): except Exception, ex: #En caso de error, lo mostramos y reseteamos todas las variables logger.error("Error en la lectura de parámentros del .json del canal: " + item.channel + " \n%s" % ex) #Mostrar los errores - logger.debug(ver_enlaces_veronline) - logger.debug(verificar_enlaces_veronline) - logger.debug(verificar_enlaces_veronline_validos) - logger.debug(excluir_enlaces_veronline) - logger.debug(ver_enlaces_descargas) - logger.debug(verificar_enlaces_descargas) - logger.debug(verificar_enlaces_descargas_validos) - logger.debug(excluir_enlaces_descargas) + logger.error(ver_enlaces_veronline) + logger.error(verificar_enlaces_veronline) + logger.error(verificar_enlaces_veronline_validos) + logger.error(excluir_enlaces_veronline) + logger.error(ver_enlaces_descargas) + logger.error(verificar_enlaces_descargas) + logger.error(verificar_enlaces_descargas_validos) + logger.error(excluir_enlaces_descargas) #Resetear las variables a sus valores por defecto ver_enlaces_veronline = -1 #Ver todos los enlaces Ver Online verificar_enlaces_veronline = -1 #Verificar todos los enlaces Ver Online @@ -1006,15 +1060,20 @@ def findvideos(item): # Obtener la información actualizada del Episodio, si no la hay if not item.infoLabels['tmdb_id'] or (not item.infoLabels['episodio_titulo'] and item.contentType == 'episode'): - tmdb.set_infoLabels(item, True) + tmdb.set_infoLabels(item, __modo_grafico__) elif (not item.infoLabels['tvdb_id'] and item.contentType == 'episode') or item.contentChannel == "videolibrary": - tmdb.set_infoLabels(item, True) + tmdb.set_infoLabels(item, __modo_grafico__) #Restauramos la información de max num. de episodios por temporada despues de TMDB if item.infoLabels['temporada_num_episodios'] and num_episodios > item.infoLabels['temporada_num_episodios']: item.infoLabels['temporada_num_episodios'] = num_episodios # Descarga la página - data = re.sub(r"\n|\r|\t|\s{2}|()", "", httptools.downloadpage(item.url).data) + try: + data = re.sub(r"\n|\r|\t|\s{2}|()", "", httptools.downloadpage(item.url).data) + except: + logger.error("ERROR 01: FINDVIDEOS: La Web no responde o la URL es erronea " + " / DATA: " + data) + itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: FINDVIDEOS:. La Web no responde o la URL es erronea. 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 data = unicode(data, "iso-8859-1", errors="replace").encode("utf-8") data = data.replace("$!", "#!").replace("'", "\"").replace("ñ", "ñ").replace("//pictures", "/pictures") @@ -1029,10 +1088,9 @@ def findvideos(item): #Limpiamos de año y rating de episodios if item.infoLabels['episodio_titulo']: item.infoLabels['episodio_titulo'] = re.sub(r'\s?\[.*?\]', '', item.infoLabels['episodio_titulo']) - if item.infoLabels['episodio_titulo'] == item.contentSerieName: - item.infoLabels['episodio_titulo'] = '' + item.infoLabels['episodio_titulo'] = item.infoLabels['episodio_titulo'].replace(item.wanted, '') if item.infoLabels['aired'] and item.contentType == "episode": - item.infoLabels['year'] = scrapertools.find_single_match(str(item.infoLabels['aired']), r'\/(\d{4})') + item.infoLabels['year'] = scrapertools.find_single_match(str(item.infoLabels['aired']), r'\/(\d{4})') #Generamos una copia de Item para trabajar sobre ella item_local = item.clone() @@ -1040,6 +1098,10 @@ def findvideos(item): # obtenemos la url torrent patron = 'class="btn-torrent">.*?window.location.href = "(.*?)";' item_local.url = scrapertools.find_single_match(data, patron) + if not item_local.url: #error + logger.error("ERROR 02: FINDVIDEOS: Ha cambiado la estructura de la Web " + " / PATRON: " + patron + " / DATA: " + data) + itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: FINDVIDEOS: 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 item_local.url = item_local.url.replace(" ", "%20") #sustituimos espacios por %20, por si acaso #logger.debug("Patron: " + patron + " url: " + item_local.url) #logger.debug(data) @@ -1136,6 +1198,7 @@ def findvideos(item): item_local.alive = "??" #Se asume poe defecto que es link es dudoso if verificar_enlaces_veronline != 0: #Se quiere verificar si el link está activo? if cnt_enl_verif <= verificar_enlaces_veronline or verificar_enlaces_veronline == -1: #contador? + #Llama a la subfunción de check_list_links(itemlist) para cada link de servidor item_local.alive = servertools.check_video_link(enlace, servidor) #activo el link ? if verificar_enlaces_veronline_validos: #Los links tienen que ser válidos para contarlos? if item_local.alive == "Ok": #Sí @@ -1225,6 +1288,7 @@ def findvideos(item): item_local.alive = "??" #Se asume poe defecto que es link es dudoso if verificar_enlaces_descargas != 0: #Se quiere verificar si el link está activo? if cnt_enl_verif <= verificar_enlaces_descargas or verificar_enlaces_descargas == -1: #contador? + #Llama a la subfunción de check_list_links(itemlist) para primer link de servidor item_local.alive = servertools.check_video_link(enlace, servidor) #activo el link ? if verificar_enlaces_descargas_validos: #Los links tienen que ser válidos para contarlos? if item_local.alive == "Ok": #Sí @@ -1268,17 +1332,41 @@ def episodios(item): logger.info() itemlist = [] - data = re.sub(r"\n|\r|\t|\s{2,}", "", httptools.downloadpage(item.url).data) + max_temp = 1 + y = [] + if modo_ultima_temp and item.library_playcounts: #Averiguar cuantas temporadas hay en Videoteca + patron = 'season (\d+)' + matches = re.compile(patron, re.DOTALL).findall(str(item.library_playcounts)) + for x in matches: + y += [int(x)] + max_temp = max(y) + + # Obtener la información actualizada de la Serie. TMDB es imprescindible para Videoteca + if not item.infoLabels['tmdb_id']: + tmdb.set_infoLabels(item, True) + + data = '' + try: + data = re.sub(r"\n|\r|\t|\s{2,}", "", httptools.downloadpage(item.url).data) + except: #Algún error de proceso, salimos + logger.error("ERROR 01: EPISODIOS: La Web no responde o la URL es erronea") + itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: EPISODIOS:. La Web no responde o la URL es erronea. Si la Web está activa, reportar el error con el log')) + return itemlist #Busca y pre-carga todas las páginas de episodios que componen las serie, para obtener la url de cada página pattern = '' % "pagination" # item.pattern pagination = scrapertools.find_single_match(data, pattern) if pagination: - pattern = '
  • Last<\/a>' #Busca última página + if "/pg/" in item.url: + act_page = int(scrapertools.find_single_match(item.url, r'\/pg\/(\d+)')) #Num página actual + else: + act_page = 1 + pattern = '
  • Last<\/a>' #Busca última página full_url = scrapertools.find_single_match(pagination, pattern) url, last_page = scrapertools.find_single_match(full_url, r'(.*?\/pg\/)(\d+)') + last_page = int(last_page) list_pages = [item.url] - for x in range(2, int(last_page) + 1): #carga cada página para obtener la url de la siguiente + for x in range(act_page + 1, last_page + 1): #carga cada página para obtener la url de la siguiente #LAS SIGUIENTES 3 LINEAS ANULADAS: no es necesario leer la pagína siguiente. Se supone que está activa #response = httptools.downloadpage('%s%s'% (url,x)) #if response.sucess: @@ -1287,28 +1375,39 @@ def episodios(item): else: list_pages = [item.url] - for index, page in enumerate(list_pages): #Recorre la lista de páginas - data = re.sub(r"\n|\r|\t|\s{2,}", "", httptools.downloadpage(page).data) - data = unicode(data, "iso-8859-1", errors="replace").encode("utf-8") - data = data.replace("chapters", "buscar-list") #Compatibilidad con mispelisy.series.com - pattern = '
      (.*?)
    ' % "buscar-list" # item.pattern - if scrapertools.find_single_match(data, pattern): + for page in list_pages: #Recorre la lista de páginas + if not list_pages: + break + try: + if not data: + data = re.sub(r"\n|\r|\t|\s{2,}", "", httptools.downloadpage(page).data) + data = unicode(data, "iso-8859-1", errors="replace").encode("utf-8") + data = data.replace("chapters", "buscar-list") #Compatibilidad con mispelisy.series.com + pattern = '
      (.*?)
    ' % "buscar-list" # item.pattern data = scrapertools.get_match(data, pattern) - else: - logger.debug(item) - logger.debug("patron: " + pattern + " / data: " + data) - return itemlist + if not data: + raise + except: + logger.error("ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web " + " / PATRON: " + pattern + " / " + str(list_pages + " / DATA: " + data)) + itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: EPISODIOS: 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 if "pelisyseries.com" in host: pattern = ']*>
    ]+>(?P.*?)?<\/h3>.*?<\/li>' else: pattern = ']*>]+>(?P.*?)?<\/h2>' matches = re.compile(pattern, re.DOTALL).findall(data) + if not matches: #error + logger.error("ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web " + " / PATRON: " + pattern + " / DATA: " + data) + itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: EPISODIOS: 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 + data = '' + #logger.debug("patron: " + pattern) #logger.debug(matches) #Empezamos a generar cada episodio - season = "1" + season = max_temp for url, thumb, info in matches: if "pelisyseries.com" in host: #En esta web están en diferente orden interm = url @@ -1359,6 +1458,10 @@ def episodios(item): r = re.compile(pattern) match = [m.groupdict() for m in r.finditer(info)][0] + if not match: #error + logger.error("ERROR 02: EPISODIOS: Ha cambiado la estructura de la Web " + " / PATRON: " + pattern + " / DATA: " + info) + itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 02: EPISODIOS: 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 if match['season'] is None: match['season'] = season #Si no se encuentran valores, pero poner lo básico if match['episode'] is None: match['episode'] = "0" @@ -1379,13 +1482,37 @@ def episodios(item): item_local.contentEpisodeNumber = match['episode'] item_local.contentSeason = match['season'] + + if modo_ultima_temp and item.library_playcounts: #Si solo se actualiza la última temporada de Videoteca + if item_local.contentSeason < max_temp: + list_pages = [] #Sale del bucle de leer páginas + break #Sale del bucle actual del FOR de episodios por página + #if ('%sx%s' % (str(item_local.contentSeason), str(item_local.contentEpisodeNumber).zfill(2))) in item.library_playcounts: + # continue + + if item_local.active: + del item_local.active + if item_local.category: + del item_local.category + if item_local.infoLabels['title']: + del item_local.infoLabels['title'] + item_local.context = "['buscar_trailer']" item_local.action = "findvideos" + item_local.contentType = "episode" item_local.extra = "episodios" + if item_local.library_playcounts: + del item_local.library_playcounts + if item_local.library_urls: + del item_local.library_urls + if item_local.path: + del item_local.path + if item_local.update_last: + del item_local.update_last + if item_local.update_next: + del item_local.update_next itemlist.append(item_local.clone()) - - logger.debug("title: " + item_local.title + " / url: " + item_local.url + " / calidad: " + item_local.quality + " / Season: " + str(item_local.contentSeason) + " / EpisodeNumber: " + str(item_local.contentEpisodeNumber)) - + # Pasada por TMDB y clasificación de lista por temporada y episodio tmdb.set_infoLabels(itemlist, seekTmdb = True) if len(itemlist) > 1: @@ -1393,7 +1520,9 @@ def episodios(item): # Pasada para maqullaje de los títulos obtenidos desde TMDB num_episodios = 1 + num_episodios_lista = [0] num_temporada = 1 + num_episodios_flag = True for item_local in itemlist: # Si no hay datos de TMDB, pongo los datos locales que conozco @@ -1416,7 +1545,7 @@ def episodios(item): if item_local.infoLabels['episodio_titulo']: if "al" in item_local.title: #Si son episodios múltiples, ponemos nombre de serie item_local.title = '%s %s' % (item_local.title, item_local.contentSerieName) - item_local.infoLabels['episodio_titulo'] = '%s %s' % (scrapertools.find_single_match(item_local.title, r'(al \d+)'), item_local.contentSerieName) + item_local.infoLabels['episodio_titulo'] = '%s - %s' % (scrapertools.find_single_match(item_local.title, r'(al \d+)'), item_local.contentSerieName) else: item_local.title = '%s %s' % (item_local.title, item_local.infoLabels['episodio_titulo']) if item_local.infoLabels['year']: @@ -1439,8 +1568,14 @@ def episodios(item): num_episodios = item_local.contentEpisodeNumber if num_episodios and not item_local.infoLabels['temporada_num_episodios']: item_local.infoLabels['temporada_num_episodios'] = num_episodios + num_episodios_flag = False + num_episodios_lista[item_local.contentSeason:] = [num_episodios] - #logger.debug("title=[" + item_local.title + "], url=[" + item_local.url + "], item=[" + str(item_local) + "]") + #logger.debug("title: " + item_local.title + " / url: " + item_local.url + " / calidad: " + item_local.quality + " / Season: " + str(item_local.contentSeason) + " / EpisodeNumber: " + str(item_local.contentEpisodeNumber) + " / num_episodios_lista: " + str(num_episodios_lista) + str(num_episodios_flag)) + + if not num_episodios_flag: #Si el num de episodios no está informado, acualizamos episodios de toda la serie + for item_local in itemlist: + item_local.infoLabels['temporada_num_episodios'] = num_episodios_lista[item_local.contentSeason] if config.get_videolibrary_support() and len(itemlist) > 0: title = '' diff --git a/plugin.video.alfa/channels/grantorrent.json b/plugin.video.alfa/channels/grantorrent.json new file mode 100644 index 00000000..d82d7313 --- /dev/null +++ b/plugin.video.alfa/channels/grantorrent.json @@ -0,0 +1,53 @@ +{ + "id": "grantorrent", + "name": "GranTorrent", + "active": true, + "adult": false, + "language": ["*"], + "thumbnail": "grantorrent.jpg", + "banner": "grantorrent.png", + "fanart": "grantorrent.png", + "categories": [ + "torrent", + "movie", + "tvshow" + ], + "settings": [ + { + "id": "include_in_global_search", + "type": "bool", + "label": "Incluir en busqueda global", + "default": true, + "enabled": true, + "visible": true + }, + { + "id": "seleccionar_serie_temporada", + "type": "list", + "label": "Seleccionar agrupar por Serie o Temporada", + "default": 0, + "enabled": true, + "visible": true, + "lvalues": [ + "Temporada", + "Serie" + ] + }, + { + "id": "seleccionar_ult_temporadda_activa", + "type": "bool", + "label": "Seleccionar para Videoteca si estará activa solo la última Temporada", + "default": true, + "enabled": true, + "visible": true + }, + { + "id": "modo_grafico", + "type": "bool", + "label": "Buscar información extra (TMDB)", + "default": true, + "enabled": true, + "visible": true + } + ] +} diff --git a/plugin.video.alfa/channels/grantorrent.py b/plugin.video.alfa/channels/grantorrent.py new file mode 100644 index 00000000..bde52446 --- /dev/null +++ b/plugin.video.alfa/channels/grantorrent.py @@ -0,0 +1,994 @@ +# -*- coding: utf-8 -*- + +import re +import sys +import urllib +import urlparse + +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 + +host = "https://grantorrent.net/" + +dict_url_seasons = dict() +__modo_grafico__ = config.get_setting('modo_grafico', 'grantorrent') +modo_serie_temp = config.get_setting('seleccionar_serie_temporada', 'grantorrent') +modo_ultima_temp = config.get_setting('seleccionar_ult_temporadda_activa', 'grantorrent') + + +def mainlist(item): + logger.info() + + itemlist = [] + + thumb_pelis = get_thumb("channels_movie.png") + thumb_pelis_hd = get_thumb("channels_movie_hd.png") + thumb_series = get_thumb("channels_tvshow.png") + thumb_series_hd = get_thumb("channels_tvshow_hd.png") + thumb_buscar = get_thumb("search.png") + thumb_settings = get_thumb("setting_0.png") + + itemlist.append(Item(channel=item.channel, action="submenu", title="Películas", url=host, extra="peliculas", thumbnail=thumb_pelis)) + + #Buscar películas + itemlist.append(Item(channel=item.channel, action="search", title="Buscar en Películas >>", url=host, extra="peliculas", thumbnail=thumb_buscar)) + + itemlist.append(Item(channel=item.channel, action="submenu", title="Series", url=host, extra="series", thumbnail=thumb_series)) + + #Buscar series + itemlist.append(Item(channel=item.channel, action="search", title="Buscar en Series >>", url=host + "series/", extra="series", thumbnail=thumb_buscar)) + + itemlist.append( + Item(channel=item.channel, action="", title="[COLOR yellow]Configuración del Canal:[/COLOR]", url="", thumbnail=thumb_settings)) + itemlist.append( + Item(channel=item.channel, action="settingCanal", title="Opciones de Videoteca y TMDB", url="", thumbnail=thumb_settings)) + + return itemlist + + +def settingCanal(item): + from platformcode import platformtools + return platformtools.show_channel_settings() + + +def submenu(item): + logger.info() + itemlist = [] + + thumb_buscar = get_thumb("search.png") + + try: + data = re.sub(r"\n|\r|\t|\s{2}|()", "", httptools.downloadpage(item.url).data) + except: + logger.error("ERROR 01: SUBMENU: La Web no responde o ha cambiado de URL") + itemlist.append(item.clone(action='', title=item.channel.capitalize() + ': ERROR 01: La Web no responde o ha cambiado de URL. Si la Web está activa, reportar el error con el log')) + return itemlist #Algo no funciona, pintamos lo que tenemos + + if item.extra == "peliculas": + patron = '