From 5ad0f99f4268079f581c574abd03b38d08226441 Mon Sep 17 00:00:00 2001 From: Unknown Date: Sat, 19 May 2018 15:42:28 -0300 Subject: [PATCH 1/4] explora --- plugin.video.alfa/channels/search.py | 121 +++++++++++++++++++++++- plugin.video.alfa/core/tmdb.py | 111 ++++++++++++++++++++++ plugin.video.alfa/platformcode/unify.py | 22 ++++- 3 files changed, 250 insertions(+), 4 deletions(-) mode change 100755 => 100644 plugin.video.alfa/core/tmdb.py diff --git a/plugin.video.alfa/channels/search.py b/plugin.video.alfa/channels/search.py index d0bbf80d..34f98475 100644 --- a/plugin.video.alfa/channels/search.py +++ b/plugin.video.alfa/channels/search.py @@ -11,12 +11,73 @@ from core import channeltools from core.item import Item from platformcode import config, logger from platformcode import platformtools +from core import tmdb + +link_list = [] +max_links = 30 def mainlist(item): logger.info() item.channel = "search" + itemlist = [] + context = [{"title": "Elegir canales incluidos", "action": "setting_channel", "channel": item.channel}] + itemlist.append(Item(channel=item.channel, action="sub_menu", title="Buscar en canales", context=context, + thumbnail=get_thumb("search.png"))) + + itemlist.append(Item(channel=item.channel, action='genres_menu', title='Películas por Generos', type='movie')) + + itemlist.append (Item(channel=item.channel, action='discover_list', title='Películas mas populares', + context=context, + search_type='list', list_type='movie/popular')) + + itemlist.append(Item(channel=item.channel, action='discover_list', title='Películas mejor valoradas', + context=context, + search_type='list', list_type='movie/top_rated')) + + itemlist.append( + Item(channel=item.channel, action='discover_list', title='Películas Ahora en cines', context=context, + search_type='list', + list_type='movie/now_playing')) + + itemlist.append(Item(channel=item.channel, action='genres_menu', title='Series por Generos', type='tv')) + + itemlist.append( + Item(channel=item.channel, action='discover_list', title='Series mas populares', context=context, + search_type='list',list_type='tv/popular')) + + itemlist.append(Item(channel=item.channel, action='discover_list', title='Series en emisión', context=context, + search_type='list', list_type='tv/on_the_air')) + + + itemlist.append(Item(channel=item.channel, action='discover_list', title='Series mejor valoradas', context=context, + search_type='list', list_type='tv/top_rated')) + + + + + return itemlist + + +def genres_menu(item): + + itemlist = [] + + genres = tmdb.get_genres(item.type) + + logger.debug(genres) + logger.debug(genres[item.type]) + + for key, value in genres[item.type].items(): + itemlist.append(item.clone(title=value, action='discover_list', search_type='discover', + list_type=key, page='1')) + return sorted(itemlist, key=lambda it: it.title) + +def sub_menu(item): + logger.info() + item.channel = "search" + itemlist = list() context = [{"title": "Elegir canales incluidos", "action": "setting_channel", @@ -433,7 +494,7 @@ def do_search(item, categories=None): title = channel # resultados agrupados por canales - if item.contextual == True: + if item.contextual == True or item.action == 'search_tmdb': result_mode = 1 if result_mode == 0: if len(search_results[channel]) > 1: @@ -514,3 +575,61 @@ def get_saved_searches(): saved_searches_list = list(current_saved_searches_list) return saved_searches_list + + +def discover_list(item): + itemlist = [] + + itemlist = tmdb.discovery(item) + tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) + + if item.search_type=='discover': + next_page = str(int(item.page)+1) + itemlist.append(item.clone(title='Pagina Siguente', page=next_page)) + + return itemlist + +def search_tmdb(item): + logger.debug(item) + + itemlist = [] + threads = [] + logger.debug(item) + wanted = item.contentTitle + + search = do_search(item) + + if item.contentSerieName == '': + results = exact_results(search, wanted) + for result in results: + logger.debug(result) + t = Thread(target=get_links, args=[result]) + t.start() + threads.append(t) + + for thread in threads: + thread.join() + + # try: + # get_links(result) + # except: + # pass + + for link in link_list: + if link.action == 'play' and not 'trailer' in link.title.lower() and len(itemlist) < max_links: + itemlist.append(link) + + return sorted(itemlist, key=lambda it: it.server) + else: + for item in search: + if item.contentSerieName != '' and item.contentSerieName == wanted: + logger.debug(item) + itemlist.append(item) + return itemlist + +def get_links (item): + logger.info() + results =[] + channel = __import__('channels.%s' % item.from_channel, None, None, ["channels.%s" % item.from_channel]) + if len(link_list) <= max_links: + link_list.extend(getattr(channel, item.from_action)(item)) diff --git a/plugin.video.alfa/core/tmdb.py b/plugin.video.alfa/core/tmdb.py old mode 100755 new mode 100644 index 1ba25685..0412b42d --- a/plugin.video.alfa/core/tmdb.py +++ b/plugin.video.alfa/core/tmdb.py @@ -536,6 +536,54 @@ def completar_codigos(item): item.infoLabels['url_scraper'].append(url_scraper) +def discovery(item): + from core.item import Item + from platformcode import unify + + tvshow = False + itemlist = [] + logger.debug(item) + + if item.search_type == 'discover': + listado = Tmdb(discover={'url':'discover/%s' % item.type, 'with_genres':item.list_type, 'language':'es', + 'page':item.page}) + + elif item.search_type == 'list': + listado = Tmdb(list={'url': item.list_type, 'language':'es'}) + + logger.debug(listado.get_list_resultados()) + result = listado.get_list_resultados() + + for elem in result: + elem['tmdb_id']=elem['id'] + if 'title' in elem: + title = unify.normalize(elem['title']).capitalize() + contentTitle = title + elem['year'] = scrapertools.find_single_match(elem['release_date'], '(\d{4})-\d+-\d+') + else: + title = unify.normalize(elem['name']).capitalize() + tvshow = True + + logger.debug(elem) + new_item = Item(channel=item.channel, title=title, infoLabels=elem, action='search_tmdb', extra=title) + + if tvshow: + new_item.contentSerieName = title + else: + new_item.contentTitle = title + + itemlist.append(new_item) + + return itemlist + +def get_genres(type): + lang = 'es' + genres = Tmdb(tipo=type) + + return genres.dic_generos[lang] + + + # Clase auxiliar class ResultDictDefault(dict): # Python 2.4 @@ -762,6 +810,7 @@ class Tmdb(object): self.busqueda_year = kwargs.get('year', '') self.busqueda_filtro = kwargs.get('filtro', {}) self.discover = kwargs.get('discover', {}) + self.list = kwargs.get('list', {}) # Reellenar diccionario de generos si es necesario if (self.busqueda_tipo == 'movie' or self.busqueda_tipo == "tv") and \ @@ -793,6 +842,9 @@ class Tmdb(object): elif self.discover: self.__discover() + elif self.list: + self.__list() + else: logger.debug("Creado objeto vacio") @@ -947,6 +999,65 @@ class Tmdb(object): logger.error(msg) return 0 + def __list(self, index_results=0): + self.result = ResultDictDefault() + results = [] + total_results = 0 + total_pages = 0 + + # Ejemplo self.discover: {'url': 'movie/', 'with_cast': '1'} + # url: Método de la api a ejecutar + # resto de claves: Parámetros de la búsqueda concatenados a la url + type_search = self.list.get('url', '') + if type_search: + params = [] + for key, value in self.list.items(): + if key != "url": + params.append("&"+key + "=" + str(value)) + # http://api.themoviedb.org/3/movie/popolar?api_key=a1ab8b8669da03637a4b98fa39c39228&&language=es + url = ('http://api.themoviedb.org/3/%s?api_key=a1ab8b8669da03637a4b98fa39c39228%s' + % (type_search, ''.join(params))) + + logger.info("[Tmdb.py] Buscando %s:\n%s" % (type_search, url)) + resultado = self.get_json(url) + + total_results = resultado.get("total_results", -1) + total_pages = resultado.get("total_pages", 1) + + if total_results > 0: + results = resultado["results"] + if self.busqueda_filtro and results: + # TODO documentar esta parte + for key, value in dict(self.busqueda_filtro).items(): + for r in results[:]: + if key not in r or r[key] != value: + results.remove(r) + total_results -= 1 + elif total_results == -1: + results = resultado + + if index_results >= len(results): + logger.error( + "La busqueda de '%s' no dio %s resultados" % (type_search, index_results)) + return 0 + + # Retornamos el numero de resultados de esta pagina + if results: + self.results = results + self.total_results = total_results + self.total_pages = total_pages + if total_results > 0: + self.result = ResultDictDefault(self.results[index_results]) + else: + self.result = results + return len(self.results) + else: + # No hay resultados de la busqueda + logger.error("La busqueda de '%s' no dio resultados" % type_search) + return 0 + + + def __discover(self, index_results=0): self.result = ResultDictDefault() results = [] diff --git a/plugin.video.alfa/platformcode/unify.py b/plugin.video.alfa/platformcode/unify.py index 494999af..4b19a6ce 100644 --- a/plugin.video.alfa/platformcode/unify.py +++ b/plugin.video.alfa/platformcode/unify.py @@ -140,6 +140,11 @@ def remove_format(string): #logger.debug('sale de remove: %s' % string) return string +def normalize(string): + string = string.decode('utf-8') + normal = ''.join((c for c in unicodedata.normalize('NFD', unicode(string)) if unicodedata.category(c) != 'Mn')) + return normal + def simplify(string): #logger.info() @@ -148,9 +153,11 @@ def simplify(string): string = string.replace('-',' ').replace('_',' ') string = re.sub(r'\d+','', string) string = string.strip() - string = string.decode('utf-8') - notilde = ''.join((c for c in unicodedata.normalize('NFD', unicode(string)) if unicodedata.category(c) != 'Mn')) - string = notilde.decode() + notilde = normalize(string) + try: + string = notilde.decode() + except: + pass string = string.lower() #logger.debug('sale de simplify: %s' % string) @@ -410,6 +417,15 @@ def title_format(item): if lang: item.title = add_languages(item.title, simple_language) + + # Para las busquedas por canal + if item.from_channel != '': + from core import channeltools + channel_parameters = channeltools.get_channel_parameters(item.from_channel) + logger.debug(channel_parameters) + item.title = '%s [%s]' % (item.title, channel_parameters['title']) + + # Formato para actualizaciones de series en la videoteca sobreescribe los colores anteriores if item.channel=='videolibrary' and item.context!='': From 317007be454372cc20f0e67fa66f3eb2141b7cb4 Mon Sep 17 00:00:00 2001 From: Unknown Date: Sat, 19 May 2018 15:53:27 -0300 Subject: [PATCH 2/4] unify en la ultima version --- plugin.video.alfa/platformcode/unify.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugin.video.alfa/platformcode/unify.py b/plugin.video.alfa/platformcode/unify.py index 4b19a6ce..3c172fd4 100644 --- a/plugin.video.alfa/platformcode/unify.py +++ b/plugin.video.alfa/platformcode/unify.py @@ -145,6 +145,7 @@ def normalize(string): normal = ''.join((c for c in unicodedata.normalize('NFD', unicode(string)) if unicodedata.category(c) != 'Mn')) return normal + def simplify(string): #logger.info() @@ -153,6 +154,7 @@ def simplify(string): string = string.replace('-',' ').replace('_',' ') string = re.sub(r'\d+','', string) string = string.strip() + notilde = normalize(string) try: string = notilde.decode() @@ -417,7 +419,6 @@ def title_format(item): if lang: item.title = add_languages(item.title, simple_language) - # Para las busquedas por canal if item.from_channel != '': from core import channeltools From 33c7d4bf6df4f7c00c90f8780264750260f3cba3 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 24 May 2018 09:07:33 -0300 Subject: [PATCH 3/4] Ajustes para la busqueda + buscar similares --- plugin.video.alfa/channels/search.py | 36 +++++++++++++++++-- plugin.video.alfa/core/tmdb.py | 30 +++------------- .../platformcode/platformtools.py | 31 ++++++++++++---- 3 files changed, 62 insertions(+), 35 deletions(-) diff --git a/plugin.video.alfa/channels/search.py b/plugin.video.alfa/channels/search.py index 34f98475..cc274fb8 100644 --- a/plugin.video.alfa/channels/search.py +++ b/plugin.video.alfa/channels/search.py @@ -8,6 +8,7 @@ from threading import Thread from channelselector import get_thumb from core import channeltools +from core import scrapertools from core.item import Item from platformcode import config, logger from platformcode import platformtools @@ -578,14 +579,43 @@ def get_saved_searches(): def discover_list(item): + from platformcode import unify itemlist = [] - itemlist = tmdb.discovery(item) + result = tmdb.discovery(item) + + tvshow = False + + logger.debug(item) + + for elem in result: + elem['tmdb_id']=elem['id'] + if 'title' in elem: + title = unify.normalize(elem['title']).capitalize() + elem['year'] = scrapertools.find_single_match(elem['release_date'], '(\d{4})-\d+-\d+') + else: + title = unify.normalize(elem['name']).capitalize() + tvshow = True + + new_item = Item(channel='search', title=title, infoLabels=elem, action='search_tmdb', extra=title, + category='Resultados', context ='') + + if tvshow: + new_item.contentSerieName = title + else: + new_item.contentTitle = title + + itemlist.append(new_item) + tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) - if item.search_type=='discover': + if item.page != '' and len(itemlist)>0: next_page = str(int(item.page)+1) - itemlist.append(item.clone(title='Pagina Siguente', page=next_page)) + #if not 'similar' in item.list_type: + # itemlist.append(item.clone(title='Pagina Siguente', page=next_page)) + #else: + itemlist.append(Item(channel=item.channel, action='discover_list', title='Pagina Siguente', + search_type=item.search_type, list_type=item.list_type, type=item.type, page=next_page)) return itemlist diff --git a/plugin.video.alfa/core/tmdb.py b/plugin.video.alfa/core/tmdb.py index 0412b42d..d58936c6 100644 --- a/plugin.video.alfa/core/tmdb.py +++ b/plugin.video.alfa/core/tmdb.py @@ -540,41 +540,19 @@ def discovery(item): from core.item import Item from platformcode import unify - tvshow = False - itemlist = [] - logger.debug(item) - if item.search_type == 'discover': listado = Tmdb(discover={'url':'discover/%s' % item.type, 'with_genres':item.list_type, 'language':'es', 'page':item.page}) elif item.search_type == 'list': - listado = Tmdb(list={'url': item.list_type, 'language':'es'}) + if item.page == '': + item.page = '1' + listado = Tmdb(list={'url': item.list_type, 'language':'es', 'page':item.page}) logger.debug(listado.get_list_resultados()) result = listado.get_list_resultados() - for elem in result: - elem['tmdb_id']=elem['id'] - if 'title' in elem: - title = unify.normalize(elem['title']).capitalize() - contentTitle = title - elem['year'] = scrapertools.find_single_match(elem['release_date'], '(\d{4})-\d+-\d+') - else: - title = unify.normalize(elem['name']).capitalize() - tvshow = True - - logger.debug(elem) - new_item = Item(channel=item.channel, title=title, infoLabels=elem, action='search_tmdb', extra=title) - - if tvshow: - new_item.contentSerieName = title - else: - new_item.contentTitle = title - - itemlist.append(new_item) - - return itemlist + return result def get_genres(type): lang = 'es' diff --git a/plugin.video.alfa/platformcode/platformtools.py b/plugin.video.alfa/platformcode/platformtools.py index 7c934e31..701ae750 100644 --- a/plugin.video.alfa/platformcode/platformtools.py +++ b/plugin.video.alfa/platformcode/platformtools.py @@ -226,9 +226,9 @@ def render_items(itemlist, parent_item): context_commands = set_context_commands(item, parent_item) # Añadimos el item - if config.get_platform(True)['num_version'] >= 17.0: + if config.get_platform(True)['num_version'] >= 17.0 and parent_item.list_type == '': listitem.addContextMenuItems(context_commands) - else: + elif parent_item.list_type == '': listitem.addContextMenuItems(context_commands, replaceItems=True) if not item.totalItems: @@ -247,7 +247,18 @@ def render_items(itemlist, parent_item): xbmcplugin.setContent(int(sys.argv[1]), "movies") # Fijamos el "breadcrumb" - xbmcplugin.setPluginCategory(handle=int(sys.argv[1]), category=parent_item.category.capitalize()) + if parent_item.list_type == '': + breadcrumb = parent_item.category.capitalize() + else: + if 'similar' in parent_item.list_type: + if parent_item.contentTitle != '': + breadcrumb = 'Similares (%s)' % parent_item.contentTitle + else: + breadcrumb = 'Similares (%s)' % parent_item.contentSerieName + else: + breadcrumb = 'Busqueda' + + xbmcplugin.setPluginCategory(handle=int(sys.argv[1]), category=breadcrumb) # No ordenar items xbmcplugin.addSortMethod(handle=int(sys.argv[1]), sortMethod=xbmcplugin.SORT_METHOD_NONE) @@ -394,7 +405,6 @@ def set_context_commands(item, parent_item): else: context_commands.append( (command["title"], "XBMC.RunPlugin(%s?%s)" % (sys.argv[0], item.clone(**command).tourl()))) - # Opciones segun criterios, solo si el item no es un tag (etiqueta), ni es "Añadir a la videoteca", etc... if item.action and item.action not in ["add_pelicula_to_library", "add_serie_to_library", "buscartrailer"]: # Mostrar informacion: si el item tiene plot suponemos q es una serie, temporada, capitulo o pelicula @@ -430,7 +440,8 @@ def set_context_commands(item, parent_item): elif item.contentType == "movie" and (item.infoLabels['tmdb_id'] or item.infoLabels['imdb_id'] or item.contentTitle): param = "id =%s,imdb_id=%s,name=%s" \ - % (item.infoLabels['tmdb_id'], item.infoLabels['imdb_id'], item.contentTitle) + % (item.infoLabels['tmdb_id'], item.infoLabels['imdb_id'], item.contentTitle) + context_commands.append(("ExtendedInfo", "XBMC.RunScript(script.extendedinfo,info=extendedinfo,%s)" % param)) @@ -455,7 +466,7 @@ def set_context_commands(item, parent_item): (sys.argv[0], item.clone(channel="favorites", action="addFavourite", from_channel=item.channel, from_action=item.action).tourl()))) - # Buscar en otros canales + # Buscar en otros canales y similares if item.contentType in ['movie', 'tvshow'] and item.channel != 'search': # Buscar en otros canales if item.contentSerieName != '': @@ -469,6 +480,14 @@ def set_context_commands(item, parent_item): from_channel=item.channel, contextual=True).tourl()))) + if item.contentType == 'tvshow': + mediatype = 'tv' + else: + mediatype = item.contentType + context_commands.append(("[COLOR yellow]Buscar Similares[/COLOR]", "XBMC.Container.Update (%s?%s)" % ( + sys.argv[0], item.clone(channel='search', action='discover_list', search_type='list', page='1', + list_type='%s/%s/similar' % (mediatype,item.infoLabels['tmdb_id'])).tourl()))) + # Definir como Pagina de inicio if config.get_setting('start_page'): if item.action not in ['findvideos', 'play']: From 4489083254a79626587348349369ffc8a20d2326 Mon Sep 17 00:00:00 2001 From: Unknown Date: Fri, 27 Jul 2018 16:11:05 -0300 Subject: [PATCH 4/4] listo para 2.6 --- plugin.video.alfa/channels/goovie.json | 79 +++ plugin.video.alfa/channels/goovie.py | 329 ++++++++++ plugin.video.alfa/channels/pelisr.json | 79 +++ plugin.video.alfa/channels/pelisr.py | 366 +++++++++++ plugin.video.alfa/channels/retroseriestv.json | 22 + plugin.video.alfa/channels/retroseriestv.py | 213 +++++++ plugin.video.alfa/channels/search.py | 24 +- plugin.video.alfa/channels/seriesblanco.json | 49 +- plugin.video.alfa/channels/seriesblanco.py | 574 +++++++++--------- plugin.video.alfa/channels/veseriesonline.py | 88 +-- plugin.video.alfa/channelselector.py | 16 + .../media/themes/default/thumb_genres.png | Bin 0 -> 24958 bytes .../themes/default/thumb_now_playing.png | Bin 0 -> 48525 bytes .../media/themes/default/thumb_on_the_air.png | Bin 0 -> 34596 bytes .../media/themes/default/thumb_popular.png | Bin 0 -> 38774 bytes .../media/themes/default/thumb_top_rated.png | Bin 0 -> 34096 bytes 16 files changed, 1455 insertions(+), 384 deletions(-) create mode 100644 plugin.video.alfa/channels/goovie.json create mode 100644 plugin.video.alfa/channels/goovie.py create mode 100644 plugin.video.alfa/channels/pelisr.json create mode 100644 plugin.video.alfa/channels/pelisr.py create mode 100644 plugin.video.alfa/channels/retroseriestv.json create mode 100644 plugin.video.alfa/channels/retroseriestv.py mode change 100755 => 100644 plugin.video.alfa/channels/seriesblanco.json create mode 100644 plugin.video.alfa/resources/media/themes/default/thumb_genres.png create mode 100644 plugin.video.alfa/resources/media/themes/default/thumb_now_playing.png create mode 100644 plugin.video.alfa/resources/media/themes/default/thumb_on_the_air.png create mode 100644 plugin.video.alfa/resources/media/themes/default/thumb_popular.png create mode 100644 plugin.video.alfa/resources/media/themes/default/thumb_top_rated.png diff --git a/plugin.video.alfa/channels/goovie.json b/plugin.video.alfa/channels/goovie.json new file mode 100644 index 00000000..1825251d --- /dev/null +++ b/plugin.video.alfa/channels/goovie.json @@ -0,0 +1,79 @@ +{ +"id": "goovie", + "name": "Goovie", + "active": true, + "adult": false, + "language": ["cast", "lat"], + "thumbnail": "https://s15.postimg.cc/n9wp4nnzv/goovie.png", + "banner": "", + "categories": [ + "movie", + "tvshow" + ], + "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", + "Latino", + "Castellano", + "VOSE", + "VO" + ] + }, + { + "id": "include_in_newest_peliculas", + "type": "bool", + "label": "Incluir en Novedades - Peliculas", + "default": true, + "enabled": true, + "visible": true + }, + { + "id": "include_in_newest_infantiles", + "type": "bool", + "label": "Incluir en Novedades - Infantiles", + "default": true, + "enabled": true, + "visible": true + }, + { + "id": "include_in_newest_terror", + "type": "bool", + "label": "Incluir en Novedades - terror", + "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" ] + } + ] +} diff --git a/plugin.video.alfa/channels/goovie.py b/plugin.video.alfa/channels/goovie.py new file mode 100644 index 00000000..2948cf73 --- /dev/null +++ b/plugin.video.alfa/channels/goovie.py @@ -0,0 +1,329 @@ +# -*- coding: utf-8 -*- +# -*- Channel Goovie -*- +# -*- Created for Alfa-addon -*- +# -*- By the Alfa Develop Group -*- + +import re +import urllib +from channelselector import get_thumb +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 channels import filtertools +from channels import autoplay +from platformcode import config, logger + + +IDIOMAS = {'1':'Cast', '2':'Lat', '3':'VOSE', '4':'VO'} +list_language = IDIOMAS.values() + +CALIDADES = {'1':'1080','2':'720','3':'480','4':'360'} + +list_quality = ['1080', '720', '480', '360'] + +list_servers = [ + 'powvideo' +] + +__comprueba_enlaces__ = config.get_setting('comprueba_enlaces', 'goovie') +__comprueba_enlaces_num__ = config.get_setting('comprueba_enlaces_num', 'goovie') + +host = 'https://goovie.co/' + +def mainlist(item): + logger.info() + + autoplay.init(item.channel, list_servers, list_quality) + + itemlist = [] + + itemlist.append(Item(channel=item.channel, title='Peliculas', action='sub_menu', type='peliculas', + thumbnail= get_thumb('movies', auto=True))) + itemlist.append(Item(channel=item.channel, title='Series', action='sub_menu', type='series', + thumbnail= get_thumb('tvshows', auto=True))) + itemlist.append( + item.clone(title="Buscar", action="search", url=host + 'search?go=', thumbnail=get_thumb("search", auto=True), + extra='movie')) + + autoplay.show_option(item.channel, itemlist) + + return itemlist + +def sub_menu(item): + logger.info() + + itemlist=[] + + itemlist.append(Item(channel=item.channel, title='Todas', url=host + item.type, action='list_all', + thumbnail=get_thumb('all', auto=True), type=item.type)) + itemlist.append(Item(channel=item.channel, title='Genero', action='section', + thumbnail=get_thumb('genres', auto=True), type=item.type)) + itemlist.append(Item(channel=item.channel, title='Por Año', action='section', + thumbnail=get_thumb('year', auto=True), type=item.type)) + + return itemlist + +def get_source(url): + logger.info() + data = httptools.downloadpage(url).data + data = re.sub(r'"|\n|\r|\t| |
|\s{2,}', "", data) + return data + + +def get_language(lang_data): + logger.info() + language = [] + + lang_list = scrapertools.find_multiple_matches(lang_data, '/flags/(.*?).png\)') + for lang in lang_list: + if lang == 'en': + lang = 'vose' + if lang not in language: + language.append(lang) + return language + +def section(item): + logger.info() + itemlist=[] + data = get_source(host+item.type) + + if 'Genero' in item.title: + data = scrapertools.find_single_match(data, 'genero.*?') + elif 'Año' in item.title: + data = scrapertools.find_single_match(data, 'año.*?') + patron = '(.*?)' + matches = re.compile(patron, re.DOTALL).findall(data) + + for scrapedurl, scrapedtitle in matches: + title = scrapedtitle + itemlist.append(Item(channel=item.channel, url=scrapedurl, title=title, action='list_all', + type=item.type)) + return itemlist + + +def list_all(item): + logger.info() + itemlist = [] + + data = get_source(item.url) + #logger.debug(data) + #return + if item.type == 'peliculas': + patron = '
.*?.*?

(.*?)

.*?' + patron += "

(.*?)

(\d{4}) /.*?.*?'(\d+)'" + matches = re.compile(patron, re.DOTALL).findall(data) + + for scrapedthumbnail, scrapedurl, scrapedtitle, scrapedplot, year, video_id in matches: + + title = '%s [%s]' % (scrapedtitle, year) + contentTitle = scrapedtitle + thumbnail = scrapedthumbnail + url = scrapedurl + + itemlist.append(item.clone(action='findvideos', + title=title, + url=url, + thumbnail=thumbnail, + contentTitle=contentTitle, + video_id=video_id, + infoLabels={'year':year})) + + elif item.type == 'series': + patron = '
.*?.*?.*?' + patron +='

(.*?)

(.*?)

(\d{4}) /' + matches = re.compile(patron, re.DOTALL).findall(data) + + for scrapedurl, scrapedthumbnail, scrapedtitle, scrapedplot, year in matches: + title = scrapedtitle + contentSerieName = scrapedtitle + thumbnail = scrapedthumbnail + url = scrapedurl + + itemlist.append(item.clone(action='seasons', + title=title, + url=url, + thumbnail=thumbnail, + plot=scrapedplot, + contentSerieName=contentSerieName, + infoLabels={'year':year})) + + tmdb.set_infoLabels(itemlist, seekTmdb=True) + # Paginación + + url_next_page = scrapertools.find_single_match(data,"") + if url_next_page: + itemlist.append(item.clone(title="Siguiente >>", url=url_next_page, action='list_all')) + + return itemlist + +def seasons(item): + logger.info() + + itemlist=[] + + data=get_source(item.url) + patron='
' + matches = re.compile(patron, re.DOTALL).findall(data) + + infoLabels = item.infoLabels + for season in matches: + season = season.lower().replace('temporada','') + infoLabels['season']=season + title = 'Temporada %s' % season + itemlist.append(Item(channel=item.channel, title=title, url=item.url, action='episodesxseasons', + infoLabels=infoLabels)) + tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) + + if config.get_videolibrary_support() and len(itemlist) > 0: + itemlist.append( + Item(channel=item.channel, title='[COLOR yellow]Añadir esta serie a la videoteca[/COLOR]', url=item.url, + action="add_serie_to_library", extra="episodios", contentSerieName=item.contentSerieName)) + + return itemlist + +def episodios(item): + logger.info() + itemlist = [] + templist = seasons(item) + for tempitem in templist: + itemlist += episodesxseasons(tempitem) + + return itemlist + +def episodesxseasons(item): + logger.info() + + itemlist = [] + + data=get_source(item.url) + logger.debug(data) + patron= "ViewEpisode\('(\d+)', this\)>
%s - (\d+)
" % item.infoLabels['season'] + patron += ".*?src=(.*?) />.*?namep>(.*?)" + + matches = re.compile(patron, re.DOTALL).findall(data) + + infoLabels = item.infoLabels + + for video_id, scrapedepisode, scrapedthumbnail, scrapedtitle in matches: + + infoLabels['episode'] = scrapedepisode + title = '%sx%s - %s' % (infoLabels['season'], infoLabels['episode'], scrapedtitle) + + itemlist.append(Item(channel=item.channel, title= title, url=item.url, thumbnail=scrapedthumbnail, + action='findvideos', video_id=video_id, infoLabels=infoLabels)) + + tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) + + return itemlist + + +def findvideos(item): + logger.info() + from lib import jsunpack + itemlist = [] + headers = {'referer':item.url} + if item.video_id == '': + find_id = get_source(item.url) + #logger.debug(find_id) + #return + item.video_id = scrapertools.find_single_match(find_id, 'var centerClick = (\d+);') + url = 'https://goovie.co/api/links/%s' % item.video_id + data = httptools.downloadpage(url, headers=headers).data + video_list = jsontools.load(data) + for video_info in video_list: + logger.debug(video_info) + url = video_info['visor'] + plot = 'idioma: %s calidad: %s' % (video_info['idioma'], video_info['calidad']) + data = httptools.downloadpage(url, headers=headers, follow_redirects=False).data + data = re.sub(r'"|\n|\r|\t| |
|\s{2,}', "", data) + packed = scrapertools.find_single_match(data, '(eval\(.*?);var') + unpacked = jsunpack.unpack(packed) + logger.debug('unpacked %s' % unpacked) + server = scrapertools.find_single_match(unpacked, "src:.'(http://\D+)/") + id = scrapertools.find_single_match(unpacked, "src:.'http://\D+/.*?description:.'(.*?).'") + if server == '': + if 'powvideo' in unpacked: + id = scrapertools.find_single_match(unpacked ,",description:.'(.*?).'") + server= 'https://powvideo.net' + url = '%s/%s' % (server, id) + if server != '' and id != '': + language = IDIOMAS[video_info['idioma']] + quality = CALIDADES[video_info['calidad']] + title = ' [%s] [%s]' % (language, quality) + itemlist.append(Item(channel=item.channel, title='%s'+title, url=url, action='play', language=language, + quality=quality)) + + itmelist = servertools.get_servers_itemlist(itemlist, lambda i: i.title % i.server.capitalize()) + return sorted(itemlist, key=lambda i: i.language) + + +def search(item, texto): + logger.info() + texto = texto.replace(" ", "+") + item.url = item.url + texto + item.type = 'peliculas' + if texto != '': + return search_results(item) + else: + return [] + +def search_results(item): + logger.info() + + itemlist=[] + + data=get_source(item.url) + logger.debug(data) + patron = '
.*?href=(.*?)>.*?typeContent>(.*?)<.*?' + patron += '.*?

(.*?)

(.*?)

(\d{4})<' + matches = re.compile(patron, re.DOTALL).findall(data) + + for scrapedurl, content_type ,scrapedthumb, scrapedtitle, scrapedplot, year in matches: + + title = scrapedtitle + url = scrapedurl + thumbnail = scrapedthumb + plot = scrapedplot + if content_type != 'Serie': + action = 'findvideos' + else: + action = 'seasons' + + new_item=Item(channel=item.channel, title=title, url=url, thumbnail=thumbnail, plot=plot, + action=action, type=content_type, infoLabels={'year':year}) + if new_item.action == 'findvideos': + new_item.contentTitle = new_item.title + else: + new_item.contentSerieName = new_item.title + + itemlist.append(new_item) + + tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) + + return itemlist + +def newest(categoria): + logger.info() + itemlist = [] + item = Item() + try: + if categoria in ['peliculas']: + item.url = host + 'peliculas' + elif categoria == 'infantiles': + item.url = host + 'peliculas/generos/animación' + elif categoria == 'terror': + item.url = host + 'peliculas/generos/terror' + item.type='peliculas' + 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/pelisr.json b/plugin.video.alfa/channels/pelisr.json new file mode 100644 index 00000000..92257e9e --- /dev/null +++ b/plugin.video.alfa/channels/pelisr.json @@ -0,0 +1,79 @@ +{ +"id": "pelisr", + "name": "PelisR", + "active": true, + "adult": false, + "language": ["lat", "cast", "vose"], + "thumbnail": "https://s22.postimg.cc/gcp2jqbs1/pelisr.png", + "banner": "", + "categories": [ + "movie", + "tvshow", + "direct" + ], + "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", + "Latino", + "Castellano", + "VOSE" + ] + }, + { + "id": "include_in_newest_peliculas", + "type": "bool", + "label": "Incluir en Novedades - Peliculas", + "default": true, + "enabled": true, + "visible": true + }, + { + "id": "include_in_newest_infantiles", + "type": "bool", + "label": "Incluir en Novedades - Infantiles", + "default": true, + "enabled": true, + "visible": true + }, + { + "id": "include_in_newest_terror", + "type": "bool", + "label": "Incluir en Novedades - terror", + "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" ] + } + ] +} diff --git a/plugin.video.alfa/channels/pelisr.py b/plugin.video.alfa/channels/pelisr.py new file mode 100644 index 00000000..7d826449 --- /dev/null +++ b/plugin.video.alfa/channels/pelisr.py @@ -0,0 +1,366 @@ +# -*- coding: utf-8 -*- +# -*- Channel PoseidonHD -*- +# -*- Created for Alfa-addon -*- +# -*- By the Alfa Develop Group -*- + +import re +import urllib +import base64 + +from channelselector import get_thumb +from core import httptools +from core import jsontools +from core import scrapertools +from core import servertools +from core import tmdb +from lib import jsunpack +from core.item import Item +from channels import filtertools +from channels import autoplay +from platformcode import config, logger + + +IDIOMAS = {'mx': 'Latino', 'dk':'Latino', 'es': 'Castellano', 'en': 'VOSE', 'gb':'VOSE'} +list_language = IDIOMAS.values() + +list_quality = ['360P', '480P', '720P', '1080P'] + +list_servers = [ + 'directo', + 'openload', + 'rapidvideo' +] + +__comprueba_enlaces__ = config.get_setting('comprueba_enlaces', 'poseidonhd') +__comprueba_enlaces_num__ = config.get_setting('comprueba_enlaces_num', 'poseidonhd') + +host = 'https://pelisr.com/' + +def mainlist(item): + logger.info() + + autoplay.init(item.channel, list_servers, list_quality) + + itemlist = [] + + itemlist.append(Item(channel=item.channel, title='Peliculas', action='menu_movies', + thumbnail= get_thumb('movies', auto=True))) + itemlist.append(Item(channel=item.channel, title='Series', url=host+'tvshows', action='list_all', type='tvshows', + thumbnail= get_thumb('tvshows', auto=True))) + itemlist.append( + item.clone(title="Buscar", action="search", url=host + '?s=', thumbnail=get_thumb("search", auto=True), + extra='movie')) + + autoplay.show_option(item.channel, itemlist) + + return itemlist + +def menu_movies(item): + logger.info() + + itemlist=[] + + itemlist.append(Item(channel=item.channel, title='Todas', url=host + 'movies', action='list_all', + thumbnail=get_thumb('all', auto=True), type='movies')) + itemlist.append(Item(channel=item.channel, title='Genero', action='section', + thumbnail=get_thumb('genres', auto=True), type='movies')) + itemlist.append(Item(channel=item.channel, title='Por Año', action='section', + thumbnail=get_thumb('year', auto=True), type='movies')) + + return itemlist + +def get_source(url): + logger.info() + data = httptools.downloadpage(url).data + data = re.sub(r'"|\n|\r|\t| |
|\s{2,}', "", data) + return data + + +def get_language(lang_data): + logger.info() + language = [] + logger.debug(lang_data) + lang_list = scrapertools.find_multiple_matches(lang_data, '/flags/(.*?).png\)') + for lang in lang_list: + if lang == 'en': + lang = 'vose' + if lang not in language: + language.append(lang) + return language + +def section(item): + logger.info() + itemlist=[] + duplicados=[] + data = get_source(host+'/'+item.type) + if 'Genero' in item.title: + patron = '
  • (.*?)/i>' + elif 'Año' in item.title: + patron = '
  • (.*?)' + elif 'Calidad' in item.title: + patron = 'menu-item-object-dtquality menu-item-\d+>(.*?)' + + matches = re.compile(patron, re.DOTALL).findall(data) + + for scrapedurl, scrapedtitle in matches: + title = scrapedtitle + plot='' + if 'Genero' in item.title: + quantity = scrapertools.find_single_match(scrapedtitle,' (.*?)<') + title = scrapertools.find_single_match(scrapedtitle,'(.*?)
    (.*?).*?quality>(.*?)' + patron += '<\/div>.*?<\/h3>(.*?)<\/span><\/div>.*?flags(.*?)metadata' + matches = re.compile(patron, re.DOTALL).findall(data) + + for scrapedthumbnail, scrapedtitle, quality, scrapedurl, year, lang_data in matches: + + + title = '%s [%s] [%s]' % (scrapedtitle, year, quality) + contentTitle = scrapedtitle + thumbnail = scrapedthumbnail + url = scrapedurl + language = get_language(lang_data) + + itemlist.append(item.clone(action='findvideos', + title=title, + url=url, + thumbnail=thumbnail, + contentTitle=contentTitle, + language=language, + quality=quality, + infoLabels={'year':year})) + + elif item.type == 'tvshows': + patron = '
    (.*?).*?' + patron += '.*?<\/h3>(.*?)<\/span><\/div>' + matches = re.compile(patron, re.DOTALL).findall(data) + + for scrapedthumbnail, scrapedtitle, scrapedurl, year in matches: + title = scrapedtitle + contentSerieName = scrapedtitle + thumbnail = scrapedthumbnail + url = scrapedurl + + itemlist.append(item.clone(action='seasons', + title=title, + url=url, + thumbnail=thumbnail, + contentSerieName=contentSerieName, + infoLabels={'year':year})) + + tmdb.set_infoLabels(itemlist, seekTmdb=True) + # Paginación + + #url_next_page = scrapertools.find_single_match(data,"]+)>