From 195e393e31fe5e1a17c49a94db07a6f8cd4d4693 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 26 Oct 2017 16:18:07 -0300 Subject: [PATCH] Reemplazado Oh-Pelis x Oh!Latino --- .../channels/{ohpelis.json => ohlatino.json} | 6 +- plugin.video.alfa/channels/ohlatino.py | 206 +++++++++++ plugin.video.alfa/channels/ohpelis.py | 323 ------------------ 3 files changed, 209 insertions(+), 326 deletions(-) rename plugin.video.alfa/channels/{ohpelis.json => ohlatino.json} (82%) create mode 100644 plugin.video.alfa/channels/ohlatino.py delete mode 100644 plugin.video.alfa/channels/ohpelis.py diff --git a/plugin.video.alfa/channels/ohpelis.json b/plugin.video.alfa/channels/ohlatino.json similarity index 82% rename from plugin.video.alfa/channels/ohpelis.json rename to plugin.video.alfa/channels/ohlatino.json index 26b945ca..b987ac92 100644 --- a/plugin.video.alfa/channels/ohpelis.json +++ b/plugin.video.alfa/channels/ohlatino.json @@ -1,10 +1,10 @@ { - "id": "ohpelis", - "name": "OH-PELIS", + "id": "ohlatino", + "name": "OH!Latino", "active": true, "adult": false, "language": ["lat"], - "thumbnail": "https://s28.postimg.org/6v7ig831p/oh-pelis.png", + "thumbnail": "http://cinemiltonero.com/wp-content/uploads/2017/08/logo-Latino0.png", "banner": "https://s27.postimg.org/bz0fh8jpf/oh-pelis-banner.png", "version": 1, "categories": [ diff --git a/plugin.video.alfa/channels/ohlatino.py b/plugin.video.alfa/channels/ohlatino.py new file mode 100644 index 00000000..0e2c41a1 --- /dev/null +++ b/plugin.video.alfa/channels/ohlatino.py @@ -0,0 +1,206 @@ +# -*- coding: utf-8 -*- +# -*- Channel OH!Latino -*- +# -*- Created for Alfa-addon -*- +# -*- By the Alfa Develop Group -*- + +import re + +from channelselector import get_thumb +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 + +host = 'http://www.ohpeliculas.com' + +def mainlist(item): + logger.info() + itemlist = [] + data = httptools.downloadpage(host).data + patron = '
  • (.*?)<\/a> (\d+)<\/i>' + matches = scrapertools.find_multiple_matches(data, patron) + mcantidad = 0 + for scrapedurl, scrapedtitle, cantidad in matches: + mcantidad += int(cantidad) + + itemlist.append( + item.clone(title="Peliculas", + action='movies_menu' + )) + + itemlist.append( + item.clone(title="Buscar", + action="search", + url=host+'?s=', + )) + + return itemlist + + +def movies_menu(item): + logger.info() + + itemlist = [] + + itemlist.append( + item.clone(title="Todas", + action="list_all", + url=host + )) + + itemlist.append( + item.clone(title="Generos", + action="section", + url=host, extra='genres')) + + itemlist.append( + item.clone(title="Por año", + action="section", + url=host, extra='byyear' + )) + + 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 list_all(item): + logger.info() + + itemlist = [] + data = get_source(item.url) + patron = '
  • (.*?)<\/a>' + elif item.extra == 'byyear': + patron = '(\d{4})<\/a><\/li>' + matches = re.compile(patron, re.DOTALL).findall(data) + + for scrapedurl, scrapedtitle in matches: + title = scrapedtitle + url = scrapedurl + if url not in duplicated: + itemlist.append(Item(channel=item.channel, + action='list_all', + title=title, + url=url + )) + duplicated.append(url) + return itemlist + + +def search(item, texto): + logger.info() + texto = texto.replace(" ", "+") + item.url = item.url + texto + if texto != '': + return list_all(item) + + +def findvideos(item): + logger.info() + itemlist = [] + data = httptools.downloadpage(item.url).data + itemlist.extend(servertools.find_video_items(data=data)) + for videoitem in itemlist: + videoitem.channel = item.channel + videoitem.contentTitle = item.fulltitle + videoitem.infoLabels = item.infoLabels + if videoitem.server != 'youtube': + videoitem.title = item.title + ' (%s)' % videoitem.server + else: + videoitem.title = 'Trailer en %s' % videoitem.server + videoitem.action = 'play' + videoitem.server = "" + + 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", + )) + tmdb.set_infoLabels(itemlist, True) + itemlist = servertools.get_servers_itemlist(itemlist) + return itemlist + + +def newest(categoria): + logger.info() + item = Item() + try: + if categoria == 'peliculas': + item.url = host + '/release/2017/' + + elif categoria == 'infantiles': + item.url = host + '/genero/infantil/' + + itemlist = list_all(item) + if itemlist[-1].title == '>> Página siguiente': + itemlist.pop() + except: + import sys + for line in sys.exc_info(): + logger.error("%s" % line) + return [] + + return itemlist + +def play(item): + logger.info() + item.thumbnail = item.contentThumbnail + return [item] diff --git a/plugin.video.alfa/channels/ohpelis.py b/plugin.video.alfa/channels/ohpelis.py deleted file mode 100644 index 24c3a9dc..00000000 --- a/plugin.video.alfa/channels/ohpelis.py +++ /dev/null @@ -1,323 +0,0 @@ -# -*- coding: utf-8 -*- -# -*- Channel OH-PELIS -*- -# -*- Created for Alfa-addon -*- -# -*- By the Alfa Develop Group -*- - -import re - -from channelselector import get_thumb -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 - -host = 'http://www.ohpelis.com' - -def mainlist(item): - logger.info() - itemlist = [] - data = httptools.downloadpage(host).data - patron = '
  • (.*?)<\/a> (\d+)<\/i>' - matches = scrapertools.find_multiple_matches(data, patron) - mcantidad = 0 - for scrapedurl, scrapedtitle, cantidad in matches: - mcantidad += int(cantidad) - - itemlist.append( - item.clone(title="Peliculas (%s)" %mcantidad, - action='movies_menu' - )) - - itemlist.append( - item.clone(title="Series", - action='series_menu' - )) - - itemlist.append( - item.clone(title="Buscar", - action="search", - url='http://www.ohpelis.com/?s=', - )) - - return itemlist - - -def series_menu(item): - logger.info() - - itemlist = [] - - itemlist.append( - item.clone(title="Series", - action="list_all", - url=host + '/series/', - extra='serie' - )) - - return itemlist - - -def movies_menu(item): - logger.info() - - itemlist = [] - - itemlist.append( - item.clone(title="Todas", - action="list_all", - url=host + '/peliculas/' - )) - - itemlist.append( - item.clone(title="Generos", - action="section", - url=host, extra='genres')) - - itemlist.append( - item.clone(title="Por año", - action="section", - url=host, extra='byyear' - )) - - return itemlist - - -def list_all(item): - logger.info() - - itemlist = [] - data = httptools.downloadpage(item.url).data - - patron = '
    (.*?)<\/a>.*?(\d{4})<\/span>.*?' - patron += '
    (.*?)
    (\d+) - (\d+)<\/div>
    (.*?)<\/a>' - matches = re.compile(patron, re.DOTALL).findall(data) - infoLabels = item.infoLabels - num_ep = 1 - for scrapedseason, scrapedepisode, scrapedurl, scrapedtitle in matches: - season = scrapedseason - contentEpisodeNumber = num_ep - url = scrapedurl - title = '%sx%s - %s' % (season, num_ep, scrapedtitle) - itemlist.append(item.clone(title=title, - url=url, - contentEpisodeNumber=contentEpisodeNumber, - action='findvideos', - infoLabels=infoLabels - )) - num_ep += 1 - return itemlist - - -def episodesxseason(item): - logger.info() - itemlist = [] - season = item.contentSeasonNumber - data = httptools.downloadpage(item.url).data - patron = '
    %s - (\d+)<\/div>
    (.*?)<\/a>' % season - matches = re.compile(patron, re.DOTALL).findall(data) - infoLabels = item.infoLabels - num_ep = 1 - for scrapedepisode, scrapedurl, scrapedtitle in matches: - title = '%sx%s - %s' % (season, num_ep, scrapedtitle) - url = scrapedurl - infoLabels['episode'] = num_ep - itemlist.append(item.clone(title=title, - url=url, - contentEpisodeNumber=num_ep, - action='findvideos', - infoLabels=infoLabels)) - num_ep += 1 - - tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) - return itemlist - - -def findvideos(item): - logger.info() - itemlist = [] - data = httptools.downloadpage(item.url).data - itemlist.extend(servertools.find_video_items(data=data)) - for videoitem in itemlist: - videoitem.channel = item.channel - videoitem.contentTitle = item.fulltitle - videoitem.infoLabels = item.infoLabels - if videoitem.server != 'youtube': - videoitem.title = item.title + ' (%s)' % videoitem.server - else: - videoitem.title = 'Trailer en %s' % videoitem.server - videoitem.action = 'play' - videoitem.server = "" - - 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", - )) - tmdb.set_infoLabels(itemlist, True) - itemlist = servertools.get_servers_itemlist(itemlist) - return itemlist - - -def newest(categoria): - logger.info() - item = Item() - try: - if categoria == 'peliculas': - item.url = host + '/release/2017/' - - elif categoria == 'infantiles': - item.url = host + '/genero/infantil/' - - itemlist = list_all(item) - if itemlist[-1].title == '>> Página siguiente': - itemlist.pop() - except: - import sys - for line in sys.exc_info(): - logger.error("%s" % line) - return [] - - return itemlist - -def play(item): - logger.info() - item.thumbnail = item.contentThumbnail - return [item]