From 43f584ff55c8e610b864ec3d4ba311735f31a90e Mon Sep 17 00:00:00 2001 From: Intel1 <25161862+Intel11@users.noreply.github.com> Date: Fri, 16 Feb 2018 08:55:20 -0500 Subject: [PATCH] miltorrent: updated --- plugin.video.alfa/channels/miltorrents.py | 1212 +-------------------- 1 file changed, 38 insertions(+), 1174 deletions(-) diff --git a/plugin.video.alfa/channels/miltorrents.py b/plugin.video.alfa/channels/miltorrents.py index a9b4840f..f2944430 100755 --- a/plugin.video.alfa/channels/miltorrents.py +++ b/plugin.video.alfa/channels/miltorrents.py @@ -1,69 +1,18 @@ # -*- coding: utf-8 -*- +import math import os import re import unicodedata import urllib -import xbmc -import xbmcgui from core import httptools from core import scrapertools +from core import tmdb from core.item import Item from core.scrapertools import decodeHtmlentities as dhe from platformcode import config, logger -ACTION_SHOW_FULLSCREEN = 36 -ACTION_GESTURE_SWIPE_LEFT = 511 -ACTION_SELECT_ITEM = 7 -ACTION_PREVIOUS_MENU = 10 -ACTION_MOVE_LEFT = 1 -ACTION_MOVE_RIGHT = 2 -ACTION_MOVE_DOWN = 4 -ACTION_MOVE_UP = 3 -OPTION_PANEL = 6 -OPTIONS_OK = 5 - - -# Para la busqueda en bing evitando baneos - -def browser(url): - import mechanize - - # Utilizamos Browser mechanize para saltar problemas con la busqueda en bing - br = mechanize.Browser() - # Browser options - br.set_handle_equiv(False) - br.set_handle_gzip(True) - br.set_handle_redirect(True) - br.set_handle_referer(False) - br.set_handle_robots(False) - # Follows refresh 0 but not hangs on refresh > 0 - br.set_handle_refresh(mechanize._http.HTTPRefreshProcessor(), max_time=1) - # Want debugging messages? - # br.set_debug_http(True) - # br.set_debug_redirects(True) - # br.set_debug_responses(True) - - # User-Agent (this is cheating, ok?) - br.addheaders = [('User-agent', - 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_5) AppleWebKit/600.7.12 (KHTML, like Gecko) Version/7.1.7 Safari/537.85.16')] - # br.addheaders =[('Cookie','SRCHD=AF=QBRE; domain=.bing.com; expires=25 de febrero de 2018 13:00:28 GMT+1; MUIDB=3B942052D204686335322894D3086911; domain=www.bing.com;expires=24 de febrero de 2018 13:00:28 GMT+1')] - # Open some site, let's pick a random one, the first that pops in mind - r = br.open(url) - response = r.read() - print response - if "img,divreturn" in response: - r = br.open("http://ssl-proxy.my-addr.org/myaddrproxy.php/" + url) - print "prooooxy" - response = r.read() - - return response - - -api_key = "2e2160006592024ba87ccdf78c28f49f" -api_fankey = "dffe90fba4d02c199ae7a9e71330c987" - def mainlist(item): logger.info() @@ -92,7 +41,6 @@ def mainlist(item): return itemlist - def search(item, texto): logger.info() texto = texto.replace(" ", "+") @@ -129,70 +77,28 @@ def search(item, texto): logger.error("%s" % line) return [] - def peliculas(item): logger.info() itemlist = [] - - # Descarga la página data = httptools.downloadpage(item.url).data data = re.sub(r"Independance", "Independence", data) if "serie" in item.url: patron = '
(.*?)<\/div>.*?(.*?)([^<]+)\((\d\d\d\d)\)' - matches = re.compile(patron, re.DOTALL).findall(data) - - if item.extra.split("|")[0] == "search": - check_bg = item.action - if item.extra.split("|")[1] != "bglobal" and check_bg != "info": - - if len(matches) == 0: - dialog = xbmcgui.Dialog() - if dialog.yesno( - '[COLOR crimson][B]Sin resultados en[/B][/COLOR]' + '[COLOR gold][B] Mil[/B][/COLOR]' + '[COLOR floralwhite][B]torrents[/B][/COLOR]', - '[COLOR cadetblue]¿Quieres hacer una busqueda en Alfa?[/COLOR]', - '', "", '[COLOR crimson][B]No,gracias[/B][/COLOR]', - '[COLOR yellow][B]Si[/B][/COLOR]'): - item.extra = "movie" + "|" + item.extra.split("|")[2] - - return busqueda(item) - - - else: - - xbmc.executebuiltin('Action(Back)') - xbmc.sleep(500) - for p_rating, url, thumbnail, title, year in matches: try: @@ -201,11 +107,8 @@ def peliculas(item): rating = "(Sin puntuacion)" title = title.decode('latin1').encode('utf8') title_fan = re.sub(r"\[.*?\]|\(.*?\)|\d&#.*?;\d+|-|Temporada.*?Completa| ;|(Sin puntuacion)", "", title) - try: - check_rating = scrapertools.get_match(rating, '(\d+).') - if int(check_rating) >= 5 and int(check_rating) < 8: rating = "[COLOR springgreen][B]" + rating + "[/B][/COLOR]" elif int(check_rating) >= 8 and int(check_rating) < 10: @@ -214,619 +117,25 @@ def peliculas(item): rating = "[COLOR orangered][B]" + rating + "[/B][/COLOR]" else: rating = "[COLOR crimson][B]" + rating + "[/B][/COLOR]" - except: rating = "[COLOR crimson][B]" + rating + "[/B][/COLOR]" if "10." in rating: rating = re.sub(r'10\.\d+', '10', rating) - title = "[COLOR gold][B]" + title + "[/B][/COLOR]" + " " + rating + title_f = "[COLOR gold][B]" + title + "[/B][/COLOR]" + " " + rating trailer = title_fan + " " + "trailer" trailer = urllib.quote(trailer) - extra = trailer + "|" + title_fan + "|" + year + "|" + "pelicula" - - itemlist.append(Item(channel=item.channel, title=title, url=url, action="fanart", thumbnail=thumbnail, - fanart="http://imgur.com/Oi1mlFn.jpg", extra=extra, folder=True)) - + itemlist.append(Item(channel=item.channel, title=title_f, url=url, action="findvideos", thumbnail=thumbnail, + fanart="http://imgur.com/Oi1mlFn.jpg", extra=extra, folder=True, contentTitle= title, infoLabels={'year':year})) + tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True) ## Paginación patronvideos = '