diff --git a/plugin.video.alfa/channels/pelismedia.json b/plugin.video.alfa/channels/pelismedia.json new file mode 100644 index 00000000..72726692 --- /dev/null +++ b/plugin.video.alfa/channels/pelismedia.json @@ -0,0 +1,88 @@ +{ + "id": "pelismedia", + "name": "PelisMedia", + "active": true, + "adult": false, + "language": ["lat"], + "thumbnail": "https://s14.postimg.cc/eclmujsch/12715507_1112827435402340_7302361220060367711_n.jpg", + "categories": ["movie", "tvshow"], + "settings": [ + { + "id": "include_in_global_search", + "type": "bool", + "label": "Incluir en busqueda global", + "default": true, + "enabled": true, + "visible": true + }, + { + "id": "include_in_newest_peliculas", + "type": "bool", + "label": "Incluir en Novedades - Peliculas", + "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": "include_in_newest_terror", + "type": "bool", + "label": "Incluir en Novedades - terror", + "default": true, + "enabled": true, + "visible": true + }, + { + "id": "include_in_newest_latino", + "type": "bool", + "label": "Incluir en Novedades - Latino", + "default": true, + "enabled": true, + "visible": true + }, + { + "id": "perfil", + "type": "list", + "label": "Perfil de color", + "default": 2, + "enabled": true, + "visible": true, + "lvalues": [ + "Perfil 3", + "Perfil 2", + "Perfil 1", + "Ninguno" + ] + }, + { + "id": "episodios_x_pag", + "type": "list", + "label": "Episodios por página", + "default": 2, + "enabled": true, + "visible": true, + "lvalues": [ + "10", + "15", + "20", + "25", + "30" + ] + }, + { + "id": "temporada_o_todos", + "type": "bool", + "label": "Mostrar temporadas", + "default": true, + "enabled": true, + "visible": true + } + ] +} \ No newline at end of file diff --git a/plugin.video.alfa/channels/pelismedia.py b/plugin.video.alfa/channels/pelismedia.py new file mode 100644 index 00000000..0712b03f --- /dev/null +++ b/plugin.video.alfa/channels/pelismedia.py @@ -0,0 +1,289 @@ +# -*- coding: utf-8 -*- +from core import httptools +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 + +__perfil__ = int(config.get_setting('perfil', 'pelisultra')) + +# Fijar perfil de color +perfil = [['0xFFFFE6CC', '0xFFFFCE9C', '0xFF994D00'], + ['0xFFA5F6AF', '0xFF5FDA6D', '0xFF11811E'], + ['0xFF58D3F7', '0xFF2E9AFE', '0xFF2E64FE']] + +if __perfil__ < 3: + color1, color2, color3 = perfil[__perfil__] +else: + color1 = color2 = color3 = "" + +host="http://www.pelismedia.com" + +def mainlist(item): + logger.info() + itemlist = [] + item.thumbnail = get_thumb('movies', auto=True) + itemlist.append(item.clone(title="Películas:", folder=False, text_color="0xFFD4AF37", text_bold=True)) + itemlist.append(Item(channel = item.channel, title = " Novedades", action = "peliculas", url = host, + thumbnail=get_thumb('newest', auto=True))) + itemlist.append(Item(channel = item.channel, title = " Estrenos", action = "peliculas", url = host + "/genero/estrenos/", + thumbnail=get_thumb('premieres', auto=True))) + itemlist.append(Item(channel = item.channel, title = " Por género", action = "genero", url = host + "/genero/", + thumbnail=get_thumb('genres', auto=True) )) + item.thumbnail = get_thumb('tvshows', auto=True) + itemlist.append(item.clone(title="Series:", folder=False, text_color="0xFFD4AF37", text_bold=True)) + itemlist.append(Item(channel = item.channel, title = " Todas las series", action = "series", url = host + "/series/", + thumbnail=get_thumb('all', auto=True))) + itemlist.append(Item(channel = item.channel, title = " Nuevos episodios", action = "nuevos_episodios", url = host + "/episodio/", + thumbnail=get_thumb('new episodes', auto=True))) + itemlist.append(Item(channel = item.channel, title = "Buscar...", action = "search", url = host, text_color="red", text_bold=True, + thumbnail=get_thumb('search', auto=True))) + itemlist.append(item.clone(title="Configurar canal...", text_color="green", action="configuracion", text_bold=True)) + return itemlist + +def configuracion(item): + from platformcode import platformtools + ret = platformtools.show_channel_settings() + platformtools.itemlist_refresh() + return ret + +def newest(categoria): + logger.info() + itemlist = [] + item = Item() + try: + if categoria in ["peliculas", "latino"]: + item.url = host + itemlist = peliculas(item) + elif categoria == 'terror': + item.url = host + '/genero/terror/' + itemlist = peliculas(item) + elif categoria == "series": + item.url = host + "/episodio/" + itemlist = nuevos_episodios(item) + if "Pagina" in itemlist[-1].title: + itemlist.pop() + + # Se captura la excepción, para no interrumpir al canal novedades si un canal falla + except: + import sys + for line in sys.exc_info(): + logger.error("{0}".format(line)) + return [] + + return itemlist + +def peliculas(item): + #logger.info() + logger.info(item) + itemlist = [] + data = httptools.downloadpage(item.url).data + + data2 = scrapertools.find_single_match(data,'(?s)
') + + # Se saca la info + #(?s)class="ml-item.*?a href="([^"]+).*?img src="([^"]+).*?alt="([^"]+).*?class="year">(\d{4})(.*?)
(.*?)') + itemlist.append(Item(action = "findvideos", channel = item.channel, title = scrapedtitle + " (" + scrapedyear + ") [" + scrapedquality + "]", contentTitle=scrapedtitle, thumbnail = scrapedthumbnail, url = scrapedurl, quality=scrapedquality, infoLabels={'year':scrapedyear})) + else: + if item.action == "search": + itemlist.append(Item(action = "temporadas", channel = item.channel, title = scrapedtitle + " (" + scrapedyear + ")", contentSerieName=scrapedtitle, contentType="tvshow", thumbnail = scrapedthumbnail, url = scrapedurl, infoLabels={'year':scrapedyear})) + + + # InfoLabels: + tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) + + # Pagina siguiente + patron_siguiente='class="pag_b">(.*?)') + # Extrae la url y el género + patron = '(.*?)' + matches = scrapertools.find_multiple_matches(data, patron) + # Se quita "Estrenos" de la lista porque tiene su propio menu + matches.pop(0) + + for scrapedurl, scrapedtitle in matches: + itemlist.append(Item(action = "peliculas", channel = item.channel, title = scrapedtitle, url = scrapedurl)) + + return itemlist + +def series(item): + logger.info() + itemlist = [] + data = httptools.downloadpage(item.url).data + # Se saca la info + patron = '(?s)class="ml-item.*?' # base + patron += 'a href="([^"]+).*?' # url + patron += 'img src="([^"]+).*?' # imagen + patron += 'alt="([^"]+).*?' # titulo + patron += 'class="year">(\d{4})' # año + matches = scrapertools.find_multiple_matches(data, patron) + + #if config.get_setting('temporada_o_todos', 'pelisultra') == 0: + if config.get_setting('temporada_o_todos', 'pelisultra'): + accion="temporadas" + else: + accion="episodios" + + for scrapedurl, scrapedthumbnail, scrapedtitle, scrapedyear in matches: + itemlist.append(Item(action = accion, channel = item.channel, title = scrapedtitle + " (" + scrapedyear + ")", contentSerieName=scrapedtitle, contentType="tvshow", thumbnail = scrapedthumbnail, url = scrapedurl, infoLabels={'year':scrapedyear})) + + # InfoLabels: + tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) + + # Pagina siguiente + patron_siguiente='class="pag_b"> item.page + episodios_por_pagina: + itemlist_page.append(item.clone(title = ">>> Pagina siguiente", page = item.page + episodios_por_pagina)) + + # InfoLabels: + tmdb.set_infoLabels_itemlist(itemlist_page, seekTmdb=True) + + return itemlist_page + +def nuevos_episodios(item): + logger.info() + itemlist = [] + data = httptools.downloadpage(item.url).data + patron = '(?s).*?' # base + patron += '' # url + patron += '(.*?).*?' # nombre_serie + patron += '