From f441d342229dfe329254db87e8be5655d01b294c Mon Sep 17 00:00:00 2001 From: Intel1 <25161862+Intel11@users.noreply.github.com> Date: Fri, 15 Dec 2017 14:43:32 -0500 Subject: [PATCH] bricocine: web no funciona --- plugin.video.alfa/channels/bricocine.py | 2308 ----------------------- 1 file changed, 2308 deletions(-) delete mode 100755 plugin.video.alfa/channels/bricocine.py diff --git a/plugin.video.alfa/channels/bricocine.py b/plugin.video.alfa/channels/bricocine.py deleted file mode 100755 index 3da0d7bf..00000000 --- a/plugin.video.alfa/channels/bricocine.py +++ /dev/null @@ -1,2308 +0,0 @@ -# -*- coding: utf-8 -*- - -import os -import re -import urllib -import urllib2 - -import xbmcgui -from core import scrapertools -from core import servertools -from core.item import Item -from platformcode import logger - - -## Cargar los datos con la librería 'requests' -def get_page(url): - from lib import requests - response = requests.get(url) - return response.content - - -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 not ".ftrH,.ftrHd,.ftrD>" in response: - r = br.open("http://anonymouse.org/cgi-bin/anon-www.cgi/" + url) - print "prooooxy" - response = r.read() - return response - - -def mainlist(item): - logger.info() - - itemlist = [] - itemlist.append( - Item(channel=item.channel, title="[COLOR sandybrown][B]Pelis MicroHD[/B][/COLOR]", action="peliculas", - url="http://www.bricocine.com/c/hd-microhd/", thumbnail="http://s6.postimg.org/5vgi38jf5/HD_brico10.jpg", - fanart="http://s16.postimg.org/6g9tc2nyt/brico_pelifan.jpg")) - itemlist.append( - Item(channel=item.channel, title="[COLOR sandybrown][B]Pelis Bluray-Rip[/B][/COLOR]", action="peliculas", - url="http://www.bricocine.com/c/bluray-rip/", thumbnail="http://s6.postimg.org/5w82dorpt/blueraybrico.jpg", - fanart="http://i59.tinypic.com/11rdnjm.jpg")) - itemlist.append( - Item(channel=item.channel, title="[COLOR sandybrown][B]Pelis DVD-Rip[/B][/COLOR]", action="peliculas", - url="http://www.bricocine.com/c/dvdrip/", thumbnail="http://s6.postimg.org/d2dlld4y9/dvd2.jpg", - fanart="http://s6.postimg.org/hcehbq5w1/brico_blue_fan.jpg")) - itemlist.append(Item(channel=item.channel, title="[COLOR sandybrown][B]Pelis 3D[/B][/COLOR]", action="peliculas", - url="http://www.bricocine.com/c/3d/", - thumbnail="http://www.eias3d.com/wp-content/uploads/2011/07/3d2_5.png", - fanart="http://s6.postimg.org/u18rvec0h/bric3dd.jpg")) - import xbmc - ###Para musica(si hay) y borra customkeys - if xbmc.Player().isPlaying(): - xbmc.executebuiltin('xbmc.PlayMedia(Stop)') - TESTPYDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "test.py") - KEYMAPDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "customkey.xml") - REMOTEDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "remote.xml") - APPCOMMANDDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "customapp.xml") - try: - os.remove(KEYMAPDESTFILE) - print "Custom Keyboard.xml borrado" - os.remove(TESTPYDESTFILE) - print "Testpy borrado" - os.remove(REMOTEDESTFILE) - print "Remote borrado" - os.remove(APPCOMMANDDESTFILE) - print "Appcommand borrado" - xbmc.executebuiltin('Action(reloadkeymaps)') - except Exception as inst: - xbmc.executebuiltin('Action(reloadkeymaps)') - print "No hay customs" - - itemlist.append(Item(channel=item.channel, title="[COLOR sandybrown][B]Series[/B][/COLOR]", action="peliculas", - url="http://www.bricocine.com/c/series", - thumbnail="http://img0.mxstatic.com/wallpapers/bc795faa71ba7c490fcf3961f3b803bf_large.jpeg", - fanart="http://s6.postimg.org/z1ath370x/bricoseries.jpg", extra="Series")) - import xbmc - if xbmc.Player().isPlaying(): - print "PLAYIIING" - xbmc.executebuiltin('xbmc.PlayMedia(Stop)') - TESTPYDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "test.py") - KEYMAPDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "customkey.xml") - REMOTEDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "remote.xml") - APPCOMMANDDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "customapp.xml") - SEARCHDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "search.txt") - TRAILERDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "trailer.txt") - try: - os.remove(KEYMAPDESTFILE) - print "Custom Keyboard.xml borrado" - os.remove(TESTPYDESTFILE) - print "Testpy borrado" - os.remove(REMOTEDESTFILE) - print "Remote borrado" - os.remove(APPCOMMANDDESTFILE) - print "Appcommand borrado" - xbmc.executebuiltin('Action(reloadkeymaps)') - except Exception as inst: - xbmc.executebuiltin('Action(reloadkeymaps)') - print "No hay customs" - try: - os.remove(SEARCHDESTFILE) - print "Custom search.txt borrado" - except: - print "No hay search.txt" - - try: - os.remove(TRAILERDESTFILE) - print "Custom Trailer.txt borrado" - except: - print "No hay Trailer.txt" - itemlist.append(Item(channel=item.channel, title="[COLOR sandybrown][B]Buscar[/B][/COLOR]", action="search", url="", - thumbnail="http://fc04.deviantart.net/fs70/i/2012/285/3/2/poltergeist___tv_wallpaper_by_elclon-d5hmmlp.png", - fanart="http://s6.postimg.org/f44w84o5t/bricosearch.jpg", extra="search")) - - return itemlist - - -def search(item, texto): - logger.info() - texto = texto.replace(" ", "+") - item.url = "http://www.bricocine.com/index.php/?s=%s" % texto - - try: - return peliculas(item, texto.replace("+", " ")) - # Se captura la excepción, para no interrumpir al buscador global si un canal falla - except: - import sys - for line in sys.exc_info(): - logger.error("%s" % line) - return [] - - -def peliculas(item, texto=""): - logger.info() - itemlist = [] - - # Borra customkeys - import xbmc - if xbmc.Player().isPlaying(): - xbmc.executebuiltin('xbmc.PlayMedia(Stop)') - - TESTPYDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "test.py") - KEYMAPDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "customkey.xml") - REMOTEDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "remote.xml") - APPCOMMANDDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "customapp.xml") - TRAILERDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "trailer.txt") - - try: - os.remove(KEYMAPDESTFILE) - print "Custom Keyboard.xml borrado" - os.remove(TESTPYDESTFILE) - print "Testpy borrado" - os.remove(REMOTEDESTFILE) - print "Remote borrado" - os.remove(APPCOMMANDDESTFILE) - print "App borrado" - xbmc.executebuiltin('Action(reloadkeymaps)') - except Exception as inst: - xbmc.executebuiltin('Action(reloadkeymaps)') - print "No hay customs" - - try: - os.remove(TRAILERDESTFILE) - print "Trailer.txt borrado" - except: - print "No hay Trailer.txt" - - # Descarga la página - data = get_page(item.url) - data = re.sub(r"amp;", "", data) - ''' -
-
- - The Leftovers - -
-
-
-
-
-
-
-
7.4
-
-
-
-
-
-
6.2
-
- Publicado por - - - 2014-10-07T23:36:17+00:00 -
-
-

- The Leftovers – Temporada 1 -

-
- ''' - patron = 'format-standard hentry category(.*?)">.*?' - patron += '
' - patron += ' ' - patron += '1> Página siguiente" - try: - next_page = scrapertools.get_match(data, "\d+(.*?)h="ID') - except: - pass - try: - url_tvt = scrapertools.get_match(subdata_tvt, '.*?type="hidden" value="(.*?)"') - song = song.replace(" ", "%20") - print song - xbmc.executebuiltin('xbmc.PlayMedia(' + song + ')') - import xbmc, time - TESTPYDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "test.py") - urllib.urlretrieve( - "https://raw.githubusercontent.com/neno1978/script.palc.forcerefresh/master/Bricocine/test.py", - TESTPYDESTFILE) - KEYMAPDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "customkey.xml") - - urllib.urlretrieve( - "https://raw.githubusercontent.com/neno1978/script.palc.forcerefresh/master/Bricocine/customkey.xml", - KEYMAPDESTFILE) - REMOTEDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "remote.xml") - urllib.urlretrieve( - "https://raw.githubusercontent.com/neno1978/script.palc.forcerefresh/master/Bricocine/remote.xml", - REMOTEDESTFILE) - APPCOMMANDDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "customapp.xml") - urllib.urlretrieve( - "https://raw.githubusercontent.com/neno1978/script.palc.forcerefresh/master/Bricocine/customapp.xml", - APPCOMMANDDESTFILE) - - xbmc.executebuiltin('Action(reloadkeymaps)') - - except: - pass - try: - os.remove(TRAILERDESTFILE) - print "Trailer.txt borrado" - except: - print "No hay Trailer.txt" - - if os.path.exists(SEARCHDESTFILE): - try: - os.remove(KEYMAPDESTFILE) - print "Custom Keyboard.xml borrado" - os.remove(TESTPYDESTFILE) - print "Testpy borrado" - os.remove(REMOTEDESTFILE) - print "Remote borrado" - os.remove(APPCOMMANDDESTFILE) - print "Appcommand borrado" - os.remove(SEARCHDESTFILE) - print "search.txt borrado" - xbmc.executebuiltin('Action(reloadkeymaps)') - except Exception as inst: - xbmc.executebuiltin('Action(reloadkeymaps)') - print "No hay customs" - ###Busqueda en bing el id de imdb de la serie - urlbing_imdb = "http://www.bing.com/search?q=%s+tv+serie+site:imdb.com" % title.replace(' ', '+') - data = browser(urlbing_imdb) - data = re.sub(r"\n|\r|\t|\s{2}| ", "", data) - try: - subdata_imdb = scrapertools.get_match(data, '
  • (.*?)h="ID') - except: - pass - - try: - imdb_id = scrapertools.get_match(subdata_imdb, '.*?posters/(.*?)') - postertvdb = "http://thetvdb.com/banners/_cache/posters/" + postertvdb - except: - postertvdb = item.thumbnail - - if len(matches) == 0: - extra = "http://s6.postimg.org/6flcihb69/brico1sinopsis.png" - show = "http://s6.postimg.org/4asrg755b/bricotvshows2.png" - fanart_info = "http://s6.postimg.org/77fsghaz3/bricotvshows4.jpg" - fanart_trailer = "http://s6.postimg.org/77fsghaz3/bricotvshows4.jpg" - itemlist.append(Item(channel=item.channel, title=item.title, url=item.url, action="findvideos", - thumbnail=postertvdb, fanart="http://s6.postimg.org/77fsghaz3/bricotvshows4.jpg", - plot=plot, category=category, extra=extra, show=show, folder=True)) - - for fan in matches: - fanart = "http://thetvdb.com/banners/" + fan - fanart_1 = fanart - # Busca fanart para info, fanart para trailer y 2ºfanart - patron = '.*?.*?.*?.*?(.*?).*?.*?(.*?).*?.*?(.*?)' - matches = re.compile(patron, re.DOTALL).findall(data) - if len(matches) == 0: - fanart_info = fanart_1 - fanart_trailer = fanart_1 - fanart_2 = fanart_1 - show = fanart_1 - extra = postertvdb - itemlist.append(Item(channel=item.channel, title=item.title, url=item.url, action="findvideos", - thumbnail=postertvdb, fanart=fanart_1, plot=plot, category=category, - extra=extra, show=show, folder=True)) - for fanart_info, fanart_trailer, fanart_2 in matches: - fanart_info = "http://thetvdb.com/banners/" + fanart_info - fanart_trailer = "http://thetvdb.com/banners/" + fanart_trailer - fanart_2 = "http://thetvdb.com/banners/" + fanart_2 - # Busqueda de todos loas arts posibles - for id in matches: - url_fanartv = "http://webservice.fanart.tv/v3/tv/" + id_serie + "?api_key=dffe90fba4d02c199ae7a9e71330c987" - data = scrapertools.cachePage(url_fanartv) - data = re.sub(r"\n|\r|\t|\s{2}| ", "", data) - patron = '"clearlogo":.*?"url": "([^"]+)"' - matches = re.compile(patron, re.DOTALL).findall(data) - if '"tvposter"' in data: - tvposter = scrapertools.get_match(data, '"tvposter":.*?"url": "([^"]+)"') - if '"tvbanner"' in data: - tvbanner = scrapertools.get_match(data, '"tvbanner":.*?"url": "([^"]+)"') - if '"tvthumb"' in data: - tvthumb = scrapertools.get_match(data, '"tvthumb":.*?"url": "([^"]+)"') - if '"hdtvlogo"' in data: - hdtvlogo = scrapertools.get_match(data, '"hdtvlogo":.*?"url": "([^"]+)"') - if '"hdclearart"' in data: - hdtvclear = scrapertools.get_match(data, '"hdclearart":.*?"url": "([^"]+)"') - if len(matches) == 0: - item.thumbnail = postertvdb - if '"hdtvlogo"' in data: - if "showbackground" in data: - - if '"hdclearart"' in data: - thumbnail = hdtvlogo - extra = hdtvclear - show = fanart_2 - else: - thumbnail = hdtvlogo - extra = thumbnail - show = fanart_2 - itemlist.append( - Item(channel=item.channel, title=item.title, action="findvideos", url=item.url, - server="torrent", thumbnail=thumbnail, plot=plot, fanart=fanart_1, - category=category, extra=extra, show=show, folder=True)) - - - else: - if '"hdclearart"' in data: - thumbnail = hdtvlogo - extra = hdtvclear - show = fanart_2 - else: - thumbnail = hdtvlogo - extra = thumbnail - show = fanart_2 - - itemlist.append( - Item(channel=item.channel, title=item.title, action="findvideos", url=item.url, - server="torrent", thumbnail=thumbnail, plot=plot, fanart=fanart_1, extra=extra, - show=show, category=category, folder=True)) - else: - extra = "http://s6.postimg.org/6flcihb69/brico1sinopsis.png" - show = fanart_2 - itemlist.append(Item(channel=item.channel, title=item.title, action="findvideos", url=item.url, - server="torrent", thumbnail=item.thumbnail, plot=plot, fanart=fanart_1, - extra=extra, show=show, category=category, folder=True)) - - for logo in matches: - if '"hdtvlogo"' in data: - thumbnail = hdtvlogo - elif not '"hdtvlogo"' in data: - if '"clearlogo"' in data: - thumbnail = logo - else: - thumbnail = item.thumbnail - if '"clearart"' in data: - clear = scrapertools.get_match(data, '"clearart":.*?"url": "([^"]+)"') - if "showbackground" in data: - - extra = clear - show = fanart_2 - itemlist.append(Item(channel=item.channel, title=item.title, action="findvideos", url=item.url, - server="torrent", thumbnail=thumbnail, plot=plot, fanart=fanart_1, - extra=extra, show=show, category=category, folder=True)) - else: - extra = clear - show = fanart_2 - itemlist.append(Item(channel=item.channel, title=item.title, action="findvideos", url=item.url, - server="torrent", thumbnail=thumbnail, plot=plot, fanart=fanart_1, - extra=extra, show=show, category=category, folder=True)) - - if "showbackground" in data: - - if '"clearart"' in data: - clear = scrapertools.get_match(data, '"clearart":.*?"url": "([^"]+)"') - extra = clear - show = fanart_2 - else: - extra = logo - show = fanart_2 - itemlist.append(Item(channel=item.channel, title=item.title, action="findvideos", url=item.url, - server="torrent", thumbnail=thumbnail, plot=plot, fanart=fanart_1, - extra=extra, show=show, category=category, folder=True)) - - if not '"clearart"' in data and not '"showbackground"' in data: - if '"hdclearart"' in data: - extra = hdtvclear - show = fanart_2 - else: - extra = thumbnail - show = fanart_2 - itemlist.append(Item(channel=item.channel, title=item.title, action="findvideos", url=item.url, - server="torrent", thumbnail=thumbnail, plot=plot, fanart=fanart_1, extra=extra, - show=show, category=category, folder=True)) - - else: - ###Películas - title = title.decode('utf8').encode('latin1') - title = title.replace("&", " y ") - if title == "JustiCia": - title = "Justi&cia" - if title == "El milagro": - title = "Miracle" - if "La Saga Crepusculo" in title: - title = re.sub(r"La Saga", "", title) - - year = item.show.split("|")[1] - if "Saga" in title: - title = title.replace('Saga completa', '') - title = title.replace('Saga', '') - title_collection = title.replace(" ", "+") - url_collection = "http://api.themoviedb.org/3/search/collection?api_key=2e2160006592024ba87ccdf78c28f49f&query=" + title_collection + "+&language=es" - data = scrapertools.cachePage(url_collection) - data = re.sub(r"\n|\r|\t|\s{2}| ", "", data) - try: - id = scrapertools.get_match(data, '"page":1.*?"id":(.*?),') - except: - id = "" - urlc_images = "http://api.themoviedb.org/3/collection/" + id + "?api_key=2e2160006592024ba87ccdf78c28f49f" - data = scrapertools.cachePage(urlc_images) - data = re.sub(r"\n|\r|\t|\s{2}| ", "", data) - patron = '"poster_path":"(.*?)","backdrop_path":"(.*?)".*?"backdrop_path":"(.*?)".*?"backdrop_path":"(.*?)".*?"backdrop_path":"(.*?)"' - matches = re.compile(patron, re.DOTALL).findall(data) - scrapertools.printMatches(matches) - if len(matches) == 0: - posterdb = item.thumbnail - extra = "http://s6.postimg.org/6flcihb69/brico1sinopsis.png" - fanart_1 = "http://img1.gtsstatic.com/wallpapers/55cb135265088aeee5147c2db20515d8_large.jpeg" - fanart = "http://img1.gtsstatic.com/wallpapers/55cb135265088aeee5147c2db20515d8_large.jpeg" - fanart_info = "http://img1.gtsstatic.com/wallpapers/55cb135265088aeee5147c2db20515d8_large.jpeg" - fanart_trailer = "http://img1.gtsstatic.com/wallpapers/55cb135265088aeee5147c2db20515d8_large.jpeg" - fanart_2 = "http://img1.gtsstatic.com/wallpapers/55cb135265088aeee5147c2db20515d8_large.jpeg" - for posterdb, fanart_1, fanart_info, fanart_trailer, fanart_2 in matches: - posterdb = "https://image.tmdb.org/t/p/original" + posterdb - fanart_1 = "https://image.tmdb.org/t/p/original" + fanart_1 - fanart_info = "https://image.tmdb.org/t/p/original" + fanart_info - fanart_trailer = "https://image.tmdb.org/t/p/original" + fanart_trailer - fanart_2 = "https://image.tmdb.org/t/p/original" + fanart_2 - - else: - - try: - try: - ###Busqueda en Tmdb la peli por titulo y año - title_tmdb = title.replace(" ", "%20") - url_tmdb = "http://api.themoviedb.org/3/search/movie?api_key=2e2160006592024ba87ccdf78c28f49f&query=" + title_tmdb + "&year=" + year + "&language=es&include_adult=false" - data = scrapertools.cachePage(url_tmdb) - data = re.sub(r"\n|\r|\t|\s{2}| ", "", data) - id = scrapertools.get_match(data, '"page":1.*?,"id":(.*?),') - except: - if ":" in title or "(" in title: - title_tmdb = title.replace(" ", "%20") - url_tmdb = "http://api.themoviedb.org/3/search/movie?api_key=2e2160006592024ba87ccdf78c28f49f&query=" + title_tmdb + "&year=" + year + "&language=es&include_adult=false" - data = scrapertools.cachePage(url_tmdb) - data = re.sub(r"\n|\r|\t|\s{2}| ", "", data) - id = scrapertools.get_match(data, '"page":1.*?,"id":(.*?),') - else: - title_tmdb = title.replace(" ", "%20") - title_tmdb = re.sub(r"(:.*)|\(.*?\)", "", title_tmdb) - url_tmdb = "http://api.themoviedb.org/3/search/movie?api_key=2e2160006592024ba87ccdf78c28f49f&query=" + title_tmdb + "&year=" + year + "&language=es&include_adult=false" - data = scrapertools.cachePage(url_tmdb) - data = re.sub(r"\n|\r|\t|\s{2}| ", "", data) - id = scrapertools.get_match(data, '"page":1.*?,"id":(.*?),') - - - except: - ###Si no hay coincidencia realiza busqueda por bing del id Imdb - urlbing_imdb = "http://www.bing.com/search?q=%s+%s+site:imdb.com" % (title.replace(' ', '+'), year) - data = browser(urlbing_imdb) - - try: - subdata_imdb = scrapertools.get_match(data, '
  • (.*?)h="ID') - subdata_imdb = re.sub("http://anonymouse.org/cgi-bin/anon-www.cgi/", "", subdata_imdb) - except: - pass - - try: - url_imdb = scrapertools.get_match(subdata_imdb, '(.*?)h="ID') - subdata_imdb = re.sub("http://anonymouse.org/cgi-bin/anon-www.cgi/", "", subdata_imdb) - except: - pass - try: - url_imdb = scrapertools.get_match(subdata_imdb, '.*?src="([^"]+)"') - poster_imdb = poster_imdb.replace("._.*?jpg", "._V1_SX640_SY720_.jpg") - - except: - poster_imdb = posterdb - - try: - url_photo = scrapertools.get_match(data, - '
    .*?(.*?)') - patron = '([^<]+)-.*?(\d)(\d+)([^<]+).*?' - patron += 'id="([^"]+)".*?href="([^"]+)".*?id="([^"]+)" href="([^"]+)"' - matches = re.compile(patron, re.DOTALL).findall(bloque_capitulos) - if len(matches) == 0: - patron = '(.*?)(\d)(\d+)([^<]+).*?' - patron += 'id="([^"]+)".*?href="([^"]+)".*?id="([^"]+)".*?href="([^"]+)"' - matches = re.compile(patron, re.DOTALL).findall(bloque_capitulos) - if len(matches) == 0: - show = item.show - extra = item.thumbnail - ###Se identifica como serie respetando en anterior item.category - category = item.category + "|" + "series" - itemlist.append(Item(channel=item.channel, - title="[COLOR gold][B]Ooops!! Algo no va bien,pulsa para ser dirigido a otra busqueda, ...[/B][/COLOR]", - action="findvideos_peli", url=item.url, - thumbnail="http://s6.postimg.org/fay99h9ox/briconoisethumb.png", - fanart="http://s6.postimg.org/uie8tu1jl/briconoisefan.jpg", extra=extra, - show=show, category=category, plot=item.plot, folder=True)) - - import base64 - for title_links, seasson, epi, calidad, title_torrent, url_torrent, title_magnet, url_magnet in matches: - try: - season = scrapertools.get_match(data, '.*?Temporada.*?(\d+).*?Torrent') - except: - try: - ###Busqueda de season el las series que no vienen bien tipificadas como tal - season = scrapertools.get_match(data, '<span class="title">.*?-.*?(\d+)x') - except: - season = "0" - epi = re.sub(r"101|201|301|401|501|601|701|801|901", "01", epi) - epi = re.sub(r"102|202|302|402|502|602|702|802|902", "02", epi) - epi = re.sub(r"103|203|303|403|503|603|703|803|903", "03", epi) - epi = re.sub(r"104|204|304|404|504|604|704|804|904", "04", epi) - epi = re.sub(r"105|205|305|405|505|605|705|805|905", "05", epi) - epi = re.sub(r"106|206|306|406|506|606|706|806|906", "06", epi) - epi = re.sub(r"107|207|307|407|507|607|707|807|907", "07", epi) - epi = re.sub(r"108|208|308|408|508|608|708|808|908", "08", epi) - epi = re.sub(r"109|209|309|409|509|609|709|809|909", "09", epi) - epi = re.sub(r"110|210|310|410|510|610|710|810|910", "10", epi) - epi = re.sub(r"111|211|311|411|511|611|711|811|911", "11", epi) - epi = re.sub(r"112|212|312|412|512|612|712|812|912", "12", epi) - epi = re.sub(r"113|213|313|413|513|613|713|813|913", "13", epi) - epi = re.sub(r"114|214|314|414|514|614|714|814|914", "14", epi) - epi = re.sub(r"115|215|315|415|515|615|715|815|915", "15", epi) - epi = re.sub(r"116|216|316|416|516|616|716|816|916", "16", epi) - epi = re.sub(r"117|217|317|417|517|617|717|817|917", "17", epi) - epi = re.sub(r"118|218|318|418|518|618|718|818|918", "18", epi) - epi = re.sub(r"119|219|319|419|519|619|719|819|919", "19", epi) - epi = re.sub(r"120|220|320|420|520|620|720|820|920", "20", epi) - epi = re.sub(r"121|221|321|421|521|621|721|821|921", "21", epi) - epi = re.sub(r"122|222|322|422|522|622|722|822|922", "22", epi) - epi = re.sub(r"123|223|323|423|523|623|723|823|923", "23", epi) - epi = re.sub(r"124|224|324|424|524|624|724|824|924", "24", epi) - epi = re.sub(r"125|225|325|425|525|625|725|825|925", "25", epi) - epi = re.sub(r"126|226|326|426|526|626|726|826|926", "26", epi) - epi = re.sub(r"127|227|327|427|527|627|727|827|927", "27", epi) - epi = re.sub(r"128|228|328|428|528|628|728|828|928", "28", epi) - epi = re.sub(r"129|229|329|429|529|629|729|829|929", "29", epi) - epi = re.sub(r"130|230|330|430|530|630|730|830|930", "30", epi) - - seasson_epi = season + "x" + epi - seasson_epi = seasson_epi.replace(seasson_epi, "[COLOR sandybrown]" + seasson_epi + "[/COLOR]") - ###Ajuste de episodio para info_epi - if "x0" in seasson_epi: - epi = epi.replace("0", "") - - title_links = title_links.replace("\\'s", "'s") - title_torrent = "[" + title_torrent.replace("file", "torrent") + "]" - title_torrent = title_torrent.replace(title_torrent, "[COLOR green]" + title_torrent + "[/COLOR]") - title_magnet = "[" + "magnet" + "]" - title_magnet = "[COLOR red]Opción[/COLOR]" + " " + title_magnet.replace(title_magnet, - "[COLOR crimson]" + title_magnet + "[/COLOR]") - calidad = calidad.replace(calidad, "[COLOR sandybrown]" + calidad + "[/COLOR]") - title_links = title_links.replace(title_links, "[COLOR orange]" + title_links + "[/COLOR]") - title_torrent = title_links + " " + seasson_epi + calidad + "- " + title_torrent - url_torrent = base64.decodestring(url_torrent.split('&u=')[1][::-1]) - url_magnet = base64.decodestring(url_magnet.split('&u=')[1][::-1]) - title_links = re.sub(r"\n|\r|\t|\s{2}|\(.*?\)|\[.*?\]| |REPARADO", "", title_links) - title_links = title_links.replace('\[.*?\]', '') - title_links = title_links.replace('á', 'a') - title_links = title_links.replace('Á', 'A') - title_links = title_links.replace('é', 'e') - title_links = title_links.replace('í', 'i') - title_links = title_links.replace('ó', 'o') - title_links = title_links.replace('ú', 'u') - title_links = title_links.replace(' ', '%20') - - extra = season + "|" + title_links + "|" + epi - if "sinopsis.png" in item.extra: - item.extra = item.thumbnail - if "bricotvshows2.png" in item.show: - item.show = item.fanart - - itemlist.append(Item(channel=item.channel, title=title_torrent, action="episodios", url=url_torrent, - thumbnail=item.extra, fanart=item.show, plot=item.plot, extra=extra, - category=item.category, folder=True)) - itemlist.append(Item(channel=item.channel, title=title_magnet, action="episodios", url=url_magnet, - thumbnail=item.extra, fanart=item.show, extra=extra, plot=item.plot, - category=item.category, folder=True)) - try: - ###Comprueba si, aparte de cápitulos torrent/magnet hay algun torrent suelto sin magnet - checktorrent = scrapertools.get_match(data, - 'id="magnet".*?Descargar .torrent<\/a><\/li><\/ul><\/td><\/tr><tr><td><span class="title">.*?rel="nofollow">(.*?)<\/a><\/li><\/ul><\/td><\/tr><tr><td>') - except: - checktorrent = "" - ###Busqueda Torrent si los encuentra sueltos - if checktorrent == "Descargar .torrent": - torrent_bloque = scrapertools.get_match(data, - 'id="file".*?id="magnet".*?<span class="title">.*?<a id="file".*?a id="file".*?class="btn btn-primary".*?d="file"(.*?class="btn btn-primary".*?)</table>') - - patron = '<span class="title">([^<]+)- (\d)(\d+)([^<]+).*?' - patron += 'id="file".*?href="([^"]+)"' - matches = re.compile(patron, re.DOTALL).findall(torrent_bloque) - if len(matches) == 0: - patron = '<span class="title">(.*?)(\d)(\d+)([^<]+)</span></td>.*?' - patron += 'id="([^"]+)".*?href="([^"]+)"' - matches = re.compile(patron, re.DOTALL).findall(bloque_capitulos) - if len(matches) == 0: - show = item.show - extra = item.thumbnail - category = item.category + "|" + "series" - - itemlist.append(Item(channel=item.channel, - title="[COLOR gold][B]Ooops!! Algo no va bien,pulsa para ser dirigido a otra busqueda, ...[/B][/COLOR]", - action="findvideos_peli", url=item.url, - thumbnail="http://s6.postimg.org/fay99h9ox/briconoisethumb.png", - fanart="http://s6.postimg.org/uie8tu1jl/briconoisefan.jpg", extra=extra, - show=show, category=category, plot=item.plot, folder=True)) - - import base64 - - for title_links, seasson, epi, calidad, url_torrent in matches: - ## torrent - try: - season = scrapertools.get_match(data, '<title>.*?Temporada.*?(\d+).*?Torrent') - except: - ###Busqueda de season el las series que no vienen bien tipificadas como tal - season = scrapertools.get_match(data, '<span class="title">.*?-.*?(\d+)x') - epi = re.sub(r"101|201|301|401|501|601|701|801|901", "01", epi) - epi = re.sub(r"102|202|302|402|502|602|702|802|902", "02", epi) - epi = re.sub(r"103|203|303|403|503|603|703|803|903", "03", epi) - epi = re.sub(r"104|204|304|404|504|604|704|804|904", "04", epi) - epi = re.sub(r"105|205|305|405|505|605|705|805|905", "05", epi) - epi = re.sub(r"106|206|306|406|506|606|706|806|906", "06", epi) - epi = re.sub(r"107|207|307|407|507|607|707|807|907", "07", epi) - epi = re.sub(r"108|208|308|408|508|608|708|808|908", "08", epi) - epi = re.sub(r"109|209|309|409|509|609|709|809|909", "09", epi) - epi = re.sub(r"110|210|310|410|510|610|710|810|910", "10", epi) - epi = re.sub(r"111|211|311|411|511|611|711|811|911", "11", epi) - epi = re.sub(r"112|212|312|412|512|612|712|812|912", "12", epi) - epi = re.sub(r"113|213|313|413|513|613|713|813|913", "13", epi) - epi = re.sub(r"114|214|314|414|514|614|714|814|914", "14", epi) - epi = re.sub(r"115|215|315|415|515|615|715|815|915", "15", epi) - epi = re.sub(r"116|216|316|416|516|616|716|816|916", "16", epi) - epi = re.sub(r"117|217|317|417|517|617|717|817|917", "17", epi) - epi = re.sub(r"118|218|318|418|518|618|718|818|918", "18", epi) - epi = re.sub(r"119|219|319|419|519|619|719|819|919", "19", epi) - epi = re.sub(r"120|220|320|420|520|620|720|820|920", "20", epi) - epi = re.sub(r"121|221|321|421|521|621|721|821|921", "21", epi) - epi = re.sub(r"122|222|322|422|522|622|722|822|922", "22", epi) - epi = re.sub(r"123|223|323|423|523|623|723|823|923", "23", epi) - epi = re.sub(r"124|224|324|424|524|624|724|824|924", "24", epi) - epi = re.sub(r"125|225|325|425|525|625|725|825|925", "25", epi) - epi = re.sub(r"126|226|326|426|526|626|726|826|926", "26", epi) - epi = re.sub(r"127|227|327|427|527|627|727|827|927", "27", epi) - epi = re.sub(r"128|228|328|428|528|628|728|828|928", "28", epi) - epi = re.sub(r"129|229|329|429|529|629|729|829|929", "29", epi) - epi = re.sub(r"130|230|330|430|530|630|730|830|930", "30", epi) - seasson_epi = season + "x" + epi - seasson_epi = seasson_epi.replace(seasson_epi, "[COLOR sandybrown]" + seasson_epi + "[/COLOR]") - if "x0" in seasson_epi: - epi = epi.replace("0", "") - title_torrent = "[torrent]" - title_torrent = title_torrent.replace(title_torrent, "[COLOR green]" + title_torrent + "[/COLOR]") - calidad = calidad.replace(calidad, "[COLOR sandybrown]" + calidad + "[/COLOR]") - title_links = title_links.replace(title_links, "[COLOR orange]" + title_links + "[/COLOR]") - title_torrent = title_links + " " + seasson_epi + calidad + "- " + title_torrent - url_torrent = base64.decodestring(url_torrent.split('&u=')[1][::-1]) - title_links = re.sub(r"\n|\r|\t|\s{2}|\(.*?\)|\[.*?\]| |REPARADO", "", title_links) - title_links = title_links.replace('\[.*?\]', '') - title_links = title_links.replace('á', 'a') - title_links = title_links.replace('Á', 'A') - title_links = title_links.replace('é', 'e') - title_links = title_links.replace('í', 'i') - title_links = title_links.replace('ó', 'o') - title_links = title_links.replace('ú', 'u') - title_links = title_links.replace(' ', '%20') - extra = season + "|" + title_links + "|" + epi - itemlist.append(Item(channel=item.channel, title=title_torrent, action="episodios", url=url_torrent, - thumbnail=item.extra, fanart=item.show, extra=extra, plot=item.plot, - category=item.category, folder=True)) - else: - ###Busqueda cuando hay Torrent pero no magnet en la serie - if 'id="file"' in data and not 'id="magnet"' in data: - - patron = '<span class="title">([^<]+)- (\d)(\d+)([^<]+).*?' - patron += 'id="([^"]+)".*?href="([^"]+)"' - matches = re.compile(patron, re.DOTALL).findall(data) - if len(matches) == 0: - patron = '<span class="title">(.*?)(\d)(\d+)([^<]+)</span></td>.*?' - patron += 'id="([^"]+)".*?href="([^"]+)"' - matches = re.compile(patron, re.DOTALL).findall(bloque_capitulos) - if len(matches) == 0: - show = item.show - extra = item.thumbnail - category = item.category + "|" + "series" - itemlist.append(Item(channel=item.channel, - title="[COLOR gold][B]Ooops!! Algo no va bien,pulsa para ser dirigido a otra busqueda, ...[/B][/COLOR]", - action="findvideos_peli", url=item.url, - thumbnail="http://s6.postimg.org/fay99h9ox/briconoisethumb.png", - fanart="http://s6.postimg.org/uie8tu1jl/briconoisefan.jpg", extra=extra, - show=show, category=category, plot=item.plot, folder=True)) - import base64 - for title_links, seasson, epi, calidad, title_torrent, url_torrent in matches: - try: - season = scrapertools.get_match(data, '<title>.*?Temporada.*?(\d+).*?Torrent') - except: - ###Busqueda de season el las series que no vienen bien tipificadas como tal - season = scrapertools.get_match(data, '<span class="title">.*?-.*?(\d+)x') - epi = re.sub(r"101|201|301|401|501|601|701|801|901", "01", epi) - epi = re.sub(r"102|202|302|402|502|602|702|802|902", "02", epi) - epi = re.sub(r"103|203|303|403|503|603|703|803|903", "03", epi) - epi = re.sub(r"104|204|304|404|504|604|704|804|904", "04", epi) - epi = re.sub(r"105|205|305|405|505|605|705|805|905", "05", epi) - epi = re.sub(r"106|206|306|406|506|606|706|806|906", "06", epi) - epi = re.sub(r"107|207|307|407|507|607|707|807|907", "07", epi) - epi = re.sub(r"108|208|308|408|508|608|708|808|908", "08", epi) - epi = re.sub(r"109|209|309|409|509|609|709|809|909", "09", epi) - epi = re.sub(r"110|210|310|410|510|610|710|810|910", "10", epi) - epi = re.sub(r"111|211|311|411|511|611|711|811|911", "11", epi) - epi = re.sub(r"112|212|312|412|512|612|712|812|912", "12", epi) - epi = re.sub(r"113|213|313|413|513|613|713|813|913", "13", epi) - epi = re.sub(r"114|214|314|414|514|614|714|814|914", "14", epi) - epi = re.sub(r"115|215|315|415|515|615|715|815|915", "15", epi) - epi = re.sub(r"116|216|316|416|516|616|716|816|916", "16", epi) - epi = re.sub(r"117|217|317|417|517|617|717|817|917", "17", epi) - epi = re.sub(r"118|218|318|418|518|618|718|818|918", "18", epi) - epi = re.sub(r"119|219|319|419|519|619|719|819|919", "19", epi) - epi = re.sub(r"120|220|320|420|520|620|720|820|920", "20", epi) - epi = re.sub(r"121|221|321|421|521|621|721|821|921", "21", epi) - epi = re.sub(r"122|222|322|422|522|622|722|822|922", "22", epi) - epi = re.sub(r"123|223|323|423|523|623|723|823|923", "23", epi) - epi = re.sub(r"124|224|324|424|524|624|724|824|924", "24", epi) - epi = re.sub(r"125|225|325|425|525|625|725|825|925", "25", epi) - epi = re.sub(r"126|226|326|426|526|626|726|826|926", "26", epi) - epi = re.sub(r"127|227|327|427|527|627|727|827|927", "27", epi) - epi = re.sub(r"128|228|328|428|528|628|728|828|928", "28", epi) - epi = re.sub(r"129|229|329|429|529|629|729|829|929", "29", epi) - epi = re.sub(r"130|230|330|430|530|630|730|830|930", "30", epi) - - seasson_epi = season + "x" + epi - seasson_epi = seasson_epi.replace(seasson_epi, "[COLOR sandybrown]" + seasson_epi + "[/COLOR]") - if "x0" in seasson_epi: - epi = epi.replace("0", "") - title_torrent = "[" + title_torrent.replace("file", "torrent") + "]" - title_torrent = title_torrent.replace(title_torrent, "[COLOR green]" + title_torrent + "[/COLOR]") - calidad = calidad.replace(calidad, "[COLOR sandybrown]" + calidad + "[/COLOR]") - title_links = title_links.replace(title_links, "[COLOR orange]" + title_links + "[/COLOR]") - title_torrent = title_links + " " + seasson_epi + calidad + "- " + title_torrent - url_torrent = base64.decodestring(url_torrent.split('&u=')[1][::-1]) - title_links = re.sub(r"\n|\r|\t|\s{2}|\(.*?\)|\[.*?\]| |REPARADO", "", title_links) - title_links = title_links.replace('\[.*?\]', '') - title_links = title_links.replace('á', 'a') - title_links = title_links.replace('Á', 'A') - title_links = title_links.replace('é', 'e') - title_links = title_links.replace('í', 'i') - title_links = title_links.replace('ó', 'o') - title_links = title_links.replace('ú', 'u') - title_links = title_links.replace(' ', '%20') - extra = season + "|" + title_links + "|" + epi - itemlist.append(Item(channel=item.channel, title=title_torrent, action="episodios", url=url_torrent, - thumbnail=item.extra, fanart=item.show, extra=extra, plot=item.plot, - category=item.category, folder=True)) - ###Busqueda cuando hay Magnet pero no Torrent - if 'id="magnet"' in data and not 'id="file"' in data: - patron = '<span class="title">([^<]+)- (\d)(\d+)([^<]+).*?' - patron += 'id="([^"]+)" href="([^"]+)"' - matches = re.compile(patron, re.DOTALL).findall(data) - if len(matches) == 0: - patron = '<span class="title">(.*?)(\d)(\d+)([^<]+)</span></td>.*?' - patron += 'id="([^"]+)".*?href="([^"]+)"' - matches = re.compile(patron, re.DOTALL).findall(bloque_capitulos) - if len(matches) == 0: - show = item.show - extra = item.extra - itemlist.append(Item(channel=item.channel, - title="[COLOR gold][B]Ooops!! Algo no va bien,pulsa para ser dirigido a otra busqueda, ...[/B][/COLOR]", - action="findvideos_peli", url=item.url, - thumbnail="http://s6.postimg.org/fay99h9ox/briconoisethumb.png", - fanart="http://s6.postimg.org/uie8tu1jl/briconoisefan.jpg", extra=extra, show=show, - folder=True)) - import base64 - for title_links, seasson, epi, calidad, title_magnet, url_magnet in matches: - try: - season = scrapertools.get_match(data, '<title>.*?Temporada.*?(\d+).*?Torrent') - except: - ###Busqueda de season el las series que no vienen bien tipificadas como tal - season = scrapertools.get_match(data, '<span class="title">.*?-.*?(\d+)x') - epi = re.sub(r"101|201|301|401|501|601|701|801|901", "01", epi) - epi = re.sub(r"102|202|302|402|502|602|702|802|902", "02", epi) - epi = re.sub(r"103|203|303|403|503|603|703|803|903", "03", epi) - epi = re.sub(r"104|204|304|404|504|604|704|804|904", "04", epi) - epi = re.sub(r"105|205|305|405|505|605|705|805|905", "05", epi) - epi = re.sub(r"106|206|306|406|506|606|706|806|906", "06", epi) - epi = re.sub(r"107|207|307|407|507|607|707|807|907", "07", epi) - epi = re.sub(r"108|208|308|408|508|608|708|808|908", "08", epi) - epi = re.sub(r"109|209|309|409|509|609|709|809|909", "09", epi) - epi = re.sub(r"110|210|310|410|510|610|710|810|910", "10", epi) - epi = re.sub(r"111|211|311|411|511|611|711|811|911", "11", epi) - epi = re.sub(r"112|212|312|412|512|612|712|812|912", "12", epi) - epi = re.sub(r"113|213|313|413|513|613|713|813|913", "13", epi) - epi = re.sub(r"114|214|314|414|514|614|714|814|914", "14", epi) - epi = re.sub(r"115|215|315|415|515|615|715|815|915", "15", epi) - epi = re.sub(r"116|216|316|416|516|616|716|816|916", "16", epi) - epi = re.sub(r"117|217|317|417|517|617|717|817|917", "17", epi) - epi = re.sub(r"118|218|318|418|518|618|718|818|918", "18", epi) - epi = re.sub(r"119|219|319|419|519|619|719|819|919", "19", epi) - epi = re.sub(r"120|220|320|420|520|620|720|820|920", "20", epi) - epi = re.sub(r"121|221|321|421|521|621|721|821|921", "21", epi) - epi = re.sub(r"122|222|322|422|522|622|722|822|922", "22", epi) - epi = re.sub(r"123|223|323|423|523|623|723|823|923", "23", epi) - epi = re.sub(r"124|224|324|424|524|624|724|824|924", "24", epi) - epi = re.sub(r"125|225|325|425|525|625|725|825|925", "25", epi) - epi = re.sub(r"126|226|326|426|526|626|726|826|926", "26", epi) - epi = re.sub(r"127|227|327|427|527|627|727|827|927", "27", epi) - epi = re.sub(r"128|228|328|428|528|628|728|828|928", "28", epi) - epi = re.sub(r"129|229|329|429|529|629|729|829|929", "29", epi) - epi = re.sub(r"130|230|330|430|530|630|730|830|930", "30", epi) - - seasson_epi = season + "x" + epi - seasson_epi = seasson_epi.replace(seasson_epi, "[COLOR sandybrown]" + seasson_epi + "[/COLOR]") - if "x0" in seasson_epi: - epi = epi.replace("0", "") - title_magnet = "[" + "magnet" + "]" - title_magnet = "[COLOR red]Opción[/COLOR]" + " " + title_magnet.replace(title_magnet, - "[COLOR crimson]" + title_magnet + "[/COLOR]") - calidad = calidad.replace(calidad, "[COLOR sandybrown]" + calidad + "[/COLOR]") - title_links = title_links.replace(title_links, "[COLOR orange]" + title_links + "[/COLOR]") - title_magnet = title_links + " " + seasson_epi + calidad + "- " + title_magnet - url_magnet = base64.decodestring(url_magnet.split('&u=')[1][::-1]) - title_links = re.sub(r"\n|\r|\t|\s{2}|\(.*?\)|\[.*?\]| |REPARADO", "", title_links) - title_links = title_links.replace('\[.*?\]', '') - title_links = title_links.replace('á', 'a') - title_links = title_links.replace('Á', 'A') - title_links = title_links.replace('é', 'e') - title_links = title_links.replace('í', 'i') - title_links = title_links.replace('ó', 'o') - title_links = title_links.replace('ú', 'u') - title_links = title_links.replace(' ', '%20') - extra = season + "|" + title_links + "|" + epi - itemlist.append( - Item(channel=item.channel, title=title_magnet, action="episodios", url=url_magnet, thumbnail=item.extra, - fanart=item.show, extra=extra, plot=item.plot, category=item.category, folder=True)) - ###No hay video - if not 'id="file"' in data and not 'id="magnet"' in data: - show = item.show - extra = item.extra - itemlist.append(Item(channel=item.channel, - title="[COLOR gold][B]Ooops!! Algo no va bien,pulsa para ser dirigido a otra busqueda, ...[/B][/COLOR]", - action="findvideos_peli", url=item.url, - thumbnail="http://s6.postimg.org/fay99h9ox/briconoisethumb.png", - fanart="http://s6.postimg.org/uie8tu1jl/briconoisefan.jpg", extra=extra, show=show, - folder=True)) - - return itemlist - - -def episodios(item): - logger.info() - itemlist = [] - ###Borra Customkey si no hay música - import xbmc - TESTPYDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "test.py") - if not xbmc.Player().isPlaying() and os.path.exists(TESTPYDESTFILE): - TESTPYDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "test.py") - KEYMAPDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "customkey.xml") - REMOTEDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "remote.xml") - APPCOMMANDDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "customapp.xml") - try: - os.remove(KEYMAPDESTFILE) - print "Custom Keyboard.xml borrado" - os.remove(TESTPYDESTFILE) - print "Testpy borrado" - os.remove(REMOTEDESTFILE) - print "Remote borrado" - os.remove(APPCOMMANDDESTFILE) - print "Appcommand borrado" - xbmc.executebuiltin('Action(reloadkeymaps)') - except Exception as inst: - xbmc.executebuiltin('Action(reloadkeymaps)') - print "No hay customs" - - season = item.extra.split("|")[0] - title_links = item.extra.split("|")[1] - epi = item.extra.split("|")[2] - title_tag = "[COLOR yellow]Ver --[/COLOR]" - item.title = item.title.replace("Ver --", "") - if "magnet" in item.title: - title_links = title_links.replace("%20", "") - title_links = "[COLOR orange]" + title_links + " " + season + "x" + epi + "[/COLOR]" - title = title_tag + title_links + " " + item.title - else: - item.title = re.sub(r"\[.*?\]", "", item.title) - title = title_tag + "[COLOR orange]" + item.title + "[/COLOR]" + "[COLOR green][torrent][/COLOR]" - - if item.plot == "Sensación de vivir: La nueva generación": - item.plot = "90210" - if item.plot == "La historia del universo": - item.plot = "how the universe works" - try: - # Nueva busqueda bing de Imdb serie id - url_imdb = "http://www.bing.com/search?q=%s+tv+series+site:imdb.com" % item.plot.replace(' ', '+') - data = browser(url_imdb) - - data = re.sub(r"\n|\r|\t|\s{2}| ", "", data) - try: - subdata_imdb = scrapertools.get_match(data, '<li class="b_algo">(.*?)h="ID') - except: - pass - try: - imdb_id = scrapertools.get_match(subdata_imdb, '<a href=.*?http.*?imdb.com/title/(.*?)/.*?"') - except: - imdb_id = "" - ### Busca en Tmdb quinta imagen para episodios mediate Imdb id - urltmdb_imdb = "https://api.themoviedb.org/3/find/" + imdb_id + "?api_key=2e2160006592024ba87ccdf78c28f49f&external_source=imdb_id" - data = scrapertools.cachePage(urltmdb_imdb) - data = re.sub(r"\n|\r|\t|\s{2}| ", "", data) - id = scrapertools.get_match(data, '"tv_results":.*?,"id":(.*?),"') - - except: - ###Si no hay coincidencia busca directamente en Tmdb por título - if ":" in item.plot: - try: - item.plot = item.plot.replace(" ", "%20") - url_tmdb = "http://api.themoviedb.org/3/search/tv?api_key=2e2160006592024ba87ccdf78c28f49f&query=" + item.plot + "&language=es&include_adult=false" - data = scrapertools.cachePage(url_tmdb) - data = re.sub(r"\n|\r|\t|\s{2}| ", "", data) - id = scrapertools.get_match(data, 'page":1.*?,"id":(.*?),"') - except: - try: - item.plot = re.sub(r"(:.*)", "", item.plot) - item.plot = item.plot.replace(" ", "%20") - url_tmdb = "http://api.themoviedb.org/3/search/tv?api_key=2e2160006592024ba87ccdf78c28f49f&query=" + item.plot + "&language=es&include_adult=false" - data = scrapertools.cachePage(url_tmdb) - data = re.sub(r"\n|\r|\t|\s{2}| ", "", data) - id = scrapertools.get_match(data, 'page":1.*?,"id":(.*?),"') - except: - thumbnail = item.thumbnail - fanart = item.fanart - id = "" - else: - try: - if "De la A a la Z" in item.plot: - item.plot = "A to Z" - item.plot = item.plot.replace(" ", "%20") - url_tmdb = "http://api.themoviedb.org/3/search/tv?api_key=2e2160006592024ba87ccdf78c28f49f&query=" + item.plot + "&language=es&include_adult=false" - data = scrapertools.cachePage(url_tmdb) - data = re.sub(r"\n|\r|\t|\s{2}| ", "", data) - id = scrapertools.get_match(data, 'page":1.*?,"id":(.*?),"') - except: - thumbnail = item.thumbnail - fanart = item.fanart - id = "" - - ###Teniendo (o no) el id Tmdb busca imagen - urltmdb_images = "https://api.themoviedb.org/3/tv/" + id + "?api_key=2e2160006592024ba87ccdf78c28f49f" - data = scrapertools.cachePage(urltmdb_images) - data = re.sub(r"\n|\r|\t|\s{2}| ", "", data) - try: - backdrop = scrapertools.get_match(data, '"backdrop_path":"(.*?)"') - fanart_3 = "https://image.tmdb.org/t/p/original" + backdrop - fanart = fanart_3 - except: - fanart_3 = item.fanart - fanart = fanart_3 - ###Se hace también la busqueda de el thumb del episodio en Tmdb - urltmdb_epi = "https://api.themoviedb.org/3/tv/" + id + "/season/" + item.extra.split("|")[0] + "/episode/" + \ - item.extra.split("|")[2] + "/images?api_key=2e2160006592024ba87ccdf78c28f49f" - data = scrapertools.cachePage(urltmdb_epi) - data = re.sub(r"\n|\r|\t|\s{2}| ", "", data) - patron = '{"id".*?"file_path":"(.*?)","height"' - matches = re.compile(patron, re.DOTALL).findall(data) - if len(matches) == 0: - thumbnail = item.thumbnail - fanart = fanart_3 - itemlist.append( - Item(channel=item.channel, title=title, action="play", url=item.url, server="torrent", thumbnail=thumbnail, - fanart=fanart, folder=False)) - - for foto in matches: - thumbnail = "https://image.tmdb.org/t/p/original" + foto - - extra = id + "|" + season - itemlist.append( - Item(channel=item.channel, title=title, action="play", url=item.url, thumbnail=thumbnail, fanart=fanart, - category=item.category, folder=False)) - ###Busca poster de temporada Tmdb - urltmdb_temp = "http://api.themoviedb.org/3/tv/" + id + "/season/" + season + "/images?api_key=2e2160006592024ba87ccdf78c28f49f" - data = get_page(urltmdb_temp) - data = re.sub(r"\n|\r|\t|\s{2}| ", "", data) - patron = '{"id".*?"file_path":"(.*?)","height"' - matches = re.compile(patron, re.DOTALL).findall(data) - if len(matches) == 0: - thumbnail = item.thumbnail - for temp in matches: - thumbnail = "https://image.tmdb.org/t/p/original" + temp - ####Busca el fanart para el item info#### - urltmdb_faninfo = "http://api.themoviedb.org/3/tv/" + id + "/images?api_key=2e2160006592024ba87ccdf78c28f49f" - data = get_page(urltmdb_faninfo) - data = re.sub(r"\n|\r|\t|\s{2}| ", "", data) - patron = '{"backdrops".*?"file_path":".*?","height".*?"file_path":"(.*?)",' - matches = re.compile(patron, re.DOTALL).findall(data) - if len(matches) == 0: - fanart = item.fanart - for fanart_4 in matches: - fanart = "https://image.tmdb.org/t/p/original" + fanart_4 - show = item.category + "|" + item.thumbnail - ### Item info de episodios - import xbmc - xbmc.executebuiltin('Action(reloadkeymaps)') - title = "Info" - title = title.replace(title, "[COLOR skyblue]" + title + "[/COLOR]") - itemlist.append(Item(channel=item.channel, action="info_capitulos", title=title, url=item.url, thumbnail=thumbnail, - fanart=fanart, extra=item.extra, show=show, folder=False)) - - return itemlist - - -def play(item): - logger.info() - itemlist = [] - ###Opción para trailers - if "youtube" in item.url: - itemlist.append(Item(channel=item.channel, action="play", server="youtube", url=item.url, fulltitle=item.title, - fanart="http://s23.postimg.org/84vkeq863/movietrailers.jpg", folder=False)) - - import xbmc - xbmc.executebuiltin('Action(reloadkeymaps)') - itemlist.append(Item(channel=item.channel, title=item.title, action="play", url=item.url, server="torrent", - thumbnail=item.thumbnail, fanart=item.fanart, category=item.category, folder=False)) - - return itemlist - - -def findvideos_peli(item): - logger.info() - - itemlist = [] - data = get_page(item.url) - data = re.sub(r"\n|\r|\t|\s{2}| | - REPARADO", "", data) - - # Busca video si hay magnet y torrent - if 'id="magnet"' in data: - if 'id="file"' in data: - patron = '<span class="title">([^"]+)</span>.*?' - patron += 'id="([^"]+)".*?href="([^"]+)".*?id="([^"]+)" href="([^"]+)"' - - matches = re.compile(patron, re.DOTALL).findall(data) - if len(matches) == 0: - itemlist.append(Item(channel=item.channel, - title="[COLOR gold][B]El video ya no se encuentra en la web, prueba a encontrala por busqueda...[/B][/COLOR]", - thumbnail="http://s6.postimg.org/fay99h9ox/briconoisethumb.png", - fanart="http://s6.postimg.org/uie8tu1jl/briconoisefan.jpg", folder=False)) - import base64 - for title_links, title_torrent, url_torrent, title_magnet, url_magnet in matches: - - title_torrent = "[" + title_torrent.replace("file", "torrent") + "]" - title_torrent = title_torrent.replace(title_torrent, "[COLOR green]" + title_torrent + "[/COLOR]") - title_magnet = "[" + "magnet" + "]" - title_magnet = "[COLOR red]Opción[/COLOR]" + " " + title_magnet.replace(title_magnet, - "[COLOR crimson]" + title_magnet + "[/COLOR]") - title_links = title_links.replace(title_links, "[COLOR sandybrown]" + title_links + "[/COLOR]") - title_links = re.sub(r"&#.*?;|\[HD .*?\]|\(.*?\)", "", title_links) - title_tag = "[COLOR yellow]Ver --[/COLOR]" - title_torrent = title_tag + title_links + "- " + title_torrent - url_torrent = base64.decodestring(url_torrent.split('&u=')[1][::-1]) - url_magnet = base64.decodestring(url_magnet.split('&u=')[1][::-1]) - if "sinopsis.png" in item.extra and not "series" in item.category: - item.extra = "http://oi67.tinypic.com/28sxwrs.jpg" - ###Se identifica si es una serie mal tipificada - if "series" in item.category and not "Completa" in title_links: - try: - season = scrapertools.get_match(data, '<title>.*?Temporada.*?(\d+).*?Torrent') - except: - season = "1" - title_link = scrapertools.get_match(title_links, '(.*?) -') - epi = scrapertools.get_match(title_links, '-.*?(x\d+)') - if "x0" in epi: - epi = epi.replace("x0", "") - title_links = title_link - action = "episodios" - extra = season + "|" + title_links + "|" + epi - itemlist.append(Item(channel=item.channel, title=title_torrent, action=action, url=url_torrent, - server="torrent", thumbnail=item.extra, fanart=item.show, extra=extra, - category=item.category, plot=item.plot, folder=True)) - itemlist.append( - Item(channel=item.channel, title=title_magnet, action=action, url=url_magnet, server="torrent", - thumbnail=item.extra, category=item.category, fanart=item.show, extra=extra, - plot=item.plot, folder=True)) - else: - action = "play" - itemlist.append(Item(channel=item.channel, title=title_torrent, action=action, url=url_torrent, - server="torrent", thumbnail=item.extra, fanart=item.show, folder=False)) - itemlist.append( - Item(channel=item.channel, title=title_magnet, action=action, url=url_magnet, server="torrent", - thumbnail=item.extra, fanart=item.show, folder=False)) - else: - ###Busca video cuando hay torrent pero no magnet - if 'id="file"' in data and not 'id="magnet"' in data: - patron = '<span class="title">([^"]+)</span>.*?' - patron += 'id="([^"]+)".*?href="([^"]+)".*?' - - matches = re.compile(patron, re.DOTALL).findall(data) - if len(matches) == 0: - itemlist.append(Item(channel=item.channel, - title="[COLOR gold][B]El video ya no se encuentra en la web, prueba a encontrala por busqueda...[/B][/COLOR]", - thumbnail="http://s6.postimg.org/fay99h9ox/briconoisethumb.png", - fanart="http://s6.postimg.org/uie8tu1jl/briconoisefan.jpg", folder=False)) - import base64 - for title_links, title_torrent, url_torrent in matches: - ## torrent - title_torrent = "[" + title_torrent.replace("file", "torrent") + "]" - title_torrent = title_torrent.replace(title_torrent, "[COLOR green]" + title_torrent + "[/COLOR]") - title_links = title_links.replace(title_links, "[COLOR sandybrown]" + title_links + "[/COLOR]") - title_links = re.sub(r"&#.*?;", "", title_links) - title_tag = "[COLOR yellow]Ver --[/COLOR]" - title_torrent = title_tag + title_links + "- " + title_torrent - url_torrent = base64.decodestring(url_torrent.split('&u=')[1][::-1]) - if "sinopsis.png" in item.extra: - item.extra = "http://oi67.tinypic.com/28sxwrs.jpg" - ###Se identifica si es una serie mal tipificada - if "series" in item.category and not "Completa" in title_links: - try: - season = scrapertools.get_match(data, '<title>.*?Temporada.*?(\d+).*?Torrent') - except: - season = "1" - title_link = scrapertools.get_match(title_links, '(.*?) -') - epi = scrapertools.get_match(title_links, '-.*?(x\d+)') - if "x0" in epi: - epi = epi.replace("x0", "") - title_links = title_link - action = "episodios" - extra = season + "|" + title_links + "|" + epi - itemlist.append(Item(channel=item.channel, title=title_torrent, action=action, url=url_torrent, - server="torrent", thumbnail=item.extra, fanart=item.show, extra=extra, - category=item.category, plot=item.plot, folder=True)) - - else: - action = "play" - itemlist.append(Item(channel=item.channel, title=title_torrent, action=action, url=url_torrent, - server="torrent", thumbnail=item.extra, fanart=item.show, folder=False)) - ###Busca video cuando solo hay magnet y no torrent - if 'id="magnet"' in data and not 'id="file"' in data: - patron = '<span class="title">([^"]+)</span>.*?' - patron += 'id="([^"]+)" href="([^"]+)"' - - matches = re.compile(patron, re.DOTALL).findall(data) - if len(matches) == 0: - itemlist.append(Item(channel=item.channel, - title="[COLOR gold][B]El video ya no se encuentra en la web, prueba a encontrala por busqueda...[/B][/COLOR]", - thumbnail="http://s6.postimg.org/fay99h9ox/briconoisethumb.png", - fanart="http://s6.postimg.org/uie8tu1jl/briconoisefan.jpg", folder=False)) - import base64 - for title_links, title_magnet, url_magnet in matches: - title_magnet = "[" + "magnet" + "]" - title_links = title_links.replace(title_links, "[COLOR sandybrown]" + title_links + "[/COLOR]") - title_links = re.sub(r"&#.*?;", "", title_links) - title_tag = "[COLOR red]Ver --[/COLOR]" - title_magnet = title_tag + title_links + "- " + title_magnet.replace(title_magnet, - "[COLOR crimson]" + title_magnet + "[/COLOR]") - url_magnet = base64.decodestring(url_magnet.split('&u=')[1][::-1]) - if "sinopsis.png" in item.extra: - item.extra = "http://oi67.tinypic.com/28sxwrs.jpg" - ###Se identifica si es una serie mal tipificada - if "series" in item.category and not "Completa" in title_links: - try: - season = scrapertools.get_match(data, '<title>.*?Temporada.*?(\d+).*?Torrent') - except: - season = "1" - title_link = scrapertools.get_match(title_links, '(.*?) -') - epi = scrapertools.get_match(title_links, '-.*?(x\d+)') - if "x0" in epi: - epi = epi.replace("x0", "") - title_links = title_link - action = "episodios" - extra = season + "|" + title_links + "|" + epi - itemlist.append(Item(channel=item.channel, title=title_torrent, action=action, url=url_torrent, - server="torrent", thumbnail=item.extra, fanart=item.show, extra=extra, - category=item.category, plot=item.plot, folder=True)) - - else: - action = "play" - - itemlist.append( - Item(channel=item.channel, title=title_magnet, action=action, url=url_magnet, server="torrent", - thumbnail=item.extra, fanart=item.show, folder=False)) - ###No hay torrent ni magnet - if not 'id="file"' in data and not 'id="magnet"' in data: - itemlist.append(Item(channel=item.channel, - title="[COLOR gold][B]El video ya no se encuentra en la web, prueba a encontrala por busqueda...[/B][/COLOR]", - thumbnail="http://s6.postimg.org/fay99h9ox/briconoisethumb.png", - fanart="http://s6.postimg.org/uie8tu1jl/briconoisefan.jpg", folder=False)) - return itemlist - - -def trailer(item): - logger.info() - ###Crea archivo control trailer.txt para evitar la recarga de la música cuando se vuelve de trailer - import xbmc - TESTPYDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "test.py") - if os.path.exists(TESTPYDESTFILE): - TRAILERDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "trailer.txt") - - urllib.urlretrieve("https://raw.githubusercontent.com/neno1978/script.palc.forcerefresh/master/trailer.txt", - TRAILERDESTFILE) - - itemlist = [] - data = get_page(item.url) - - # trailer - patron = "<iframe width='.*?' height='.*?' src='([^']+)?" - - matches = re.compile(patron, re.DOTALL).findall(data) - if len(matches) == 0: - itemlist.append( - Item(channel=item.channel, title="[COLOR gold][B]Esta pelicula no tiene trailer,lo sentimos...[/B][/COLOR]", - thumbnail="http://s6.postimg.org/fay99h9ox/briconoisethumb.png", - fanart="http://s6.postimg.org/uie8tu1jl/briconoisefan.jpg", folder=False)) - - for url in matches: - listavideos = servertools.findvideos(url) - - for video in listavideos: - videotitle = scrapertools.unescape(video[0]) - url = video[1] - server = video[2] - - title = "[COLOR crimson]Trailer - [/COLOR]" - itemlist.append(Item(channel=item.channel, action="play", server="youtube", title=title + videotitle, url=url, - thumbnail=item.extra, fulltitle=item.title, - fanart="http://s23.postimg.org/84vkeq863/movietrailers.jpg", folder=False)) - return itemlist - - -def info(item): - logger.info() - url = item.url - data = get_page(url) - data = re.sub(r"\n|\r|\t|\s{2}| ", "", data) - if "temporada" in item.url: - ###Se prepara el Customkey para no permitir el forcerefresh y evitar conflicto con info - import xbmc - APPCOMMANDDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "customapp.xml") - try: - os.remove(APPCOMMANDDESTFILE) - except: - pass - patron = '<title>([^<]+).*?Temporada.*?' - patron += '<div class="description" itemprop="text.*?">.*?([^<]+).*?</div></div></div>' - matches = re.compile(patron, re.DOTALL).findall(data) - if len(matches) == 0: - title = "[COLOR red][B]LO SENTIMOS...[/B][/COLOR]" - plot = "Esta serie no tiene informacion..." - plot = plot.replace(plot, "[COLOR yellow][B]" + plot + "[/B][/COLOR]") - photo = "http://s6.postimg.org/nm3gk1xox/noinfosup2.png" - foto = "http://s6.postimg.org/ub7pb76c1/noinfo.png" - info = "" - quit = "Pulsa" + " [COLOR crimson][B]INTRO [/B][/COLOR]" + "para quitar" - for title, plot in matches: - plot_title = "Sinopsis" + "[CR]" - plot_title = plot_title.replace(plot_title, "[COLOR red]" + plot_title + "[/COLOR]") - plot = plot_title + plot - plot = plot.replace(plot, "[COLOR white][B]" + plot + "[/B][/COLOR]") - plot = re.sub(r'div class=".*?">', '', plot) - plot = plot.replace("div>", "") - plot = plot.replace('div class="margin_20b">', '') - plot = plot.replace('div class="post-entry">', '') - plot = plot.replace('p style="text-align: left;">', '') - title = re.sub(r"&#.*?;", "", title) - title = title.replace(title, "[COLOR sandybrown][B]" + title + "[/B][/COLOR]") - title = title.replace("-", "") - title = title.replace("Torrent", "") - title = title.replace("amp;", "") - title = title.replace("Descargar en Bricocine.com", "") - try: - scrapedinfo = scrapertools.get_match(data, 'Ficha técnica</h2><dl class="list"><dt>(.*?)hellip') - except IndexError: - scrapedinfo = scrapertools.get_match(data, - 'Ficha técnica</h2><dl class="list"><dt>(.*?)</div><div class="quad-2"') - scrapedinfo = scrapedinfo.replace("<br />", " ") - scrapedinfo = scrapedinfo.replace("</dl>", "<dt>") - scrpaedinfo = re.sub(r'<a href=".*?"|title=".*?"|item.*?=".*?"', '', scrapedinfo) - - infoformat = re.compile('(.*?</dt><dd.*?>).*?</dd><dt>', re.DOTALL).findall(scrapedinfo) - for info in infoformat: - scrapedinfo = scrapedinfo.replace(scrapedinfo, "[COLOR white][B]" + scrapedinfo + "[/COLOR]") - scrapedinfo = scrapedinfo.replace(info, "[COLOR red][B]" + info + "[/B][/COLOR]") - info = scrapedinfo - info = re.sub( - r'<a href=".*?">|title=".*?">|<span itemprop=.*?>|</span></span>|<span>|</a>|itemprop=".*?"|y otros.*?&', - '', info) - info = info.replace("</dt><dd>", ":") - info = info.replace("</dt><dd >", ":") - info = info.replace("</dt><dd > ", ":") - info = info.replace("</dd><dt>", " ") - info = info.replace("</span>", " ") - - info = info.replace("Actores:", "[COLOR red][B]Actores:[/B][/COLOR] ") - photo = item.extra - foto = item.category - quit = "Pulsa" + " [COLOR crimson][B]INTRO [/B][/COLOR]" + "para quitar" - ###Se carga Customkey no atras - NOBACKDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "noback.xml") - REMOTENOBACKDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "remotenoback.xml") - APPNOBACKDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "appnoback.xml") - urllib.urlretrieve("https://raw.githubusercontent.com/neno1978/script.palc.forcerefresh/master/noback.xml", - NOBACKDESTFILE) - urllib.urlretrieve( - "https://raw.githubusercontent.com/neno1978/script.palc.forcerefresh/master/Bricocine/remotenoback.xml", - REMOTENOBACKDESTFILE) - urllib.urlretrieve( - "https://raw.githubusercontent.com/neno1978/script.palc.forcerefresh/master/appnoback.xml", - APPNOBACKDESTFILE) - xbmc.executebuiltin('Action(reloadkeymaps)') - else: - data = get_page(item.url) - data = re.sub(r"\n|\r|\t|\s{2}| ", "", data) - patron = '<div class="description" itemprop="text.*?">.*?([^<]+).*?</div></div></div>.*?' - patron += '<span class="title">([^"]+)</span>' - matches = re.compile(patron, re.DOTALL).findall(data) - - if len(matches) == 0: - title = "[COLOR red][B]LO SENTIMOS...[/B][/COLOR]" - plot = "Esta pelicula no tiene sinopsis..." - plot = plot.replace(plot, "[COLOR yellow][B]" + plot + "[/B][/COLOR]") - foto = "http://s6.postimg.org/ub7pb76c1/noinfo.png" - photo = "http://s6.postimg.org/nm3gk1xox/noinfosup2.png" - info = "" - quit = "Pulsa" + " [COLOR crimson][B]INTRO [/B][/COLOR]" + "para quitar" - - for plot, title in matches: - title = title.upper() - title = title.replace(title, "[COLOR sandybrown][B]" + title + "[/B][/COLOR]") - title = re.sub(r"&#.*?;|\[HD .*?\]|", "", title) - plot_title = "Sinopsis" + "[CR]" - plot_title = plot_title.replace(plot_title, "[COLOR red]" + plot_title + "[/COLOR]") - plot = plot_title + plot - plot = plot.replace(plot, "[COLOR white][B]" + plot + "[/B][/COLOR]") - plot = plot.replace('div class="margin_20b">', '') - plot = plot.replace('div class="post-entry">', '') - try: - scrapedinfo = scrapertools.get_match(data, 'Ficha técnica</h2><dl class="list"><dt>(.*?)hellip') - except IndexError: - scrapedinfo = scrapertools.get_match(data, - 'Ficha técnica</h2><dl class="list"><dt>(.*?)</div><div class="quad-2"') - scrapedinfo = scrapedinfo.replace("<br />", " ") - scrapedinfo = scrapedinfo.replace("</dl>", "<dt>") - scrpaedinfo = re.sub(r'<a href=".*?"|title=".*?"|item.*?=".*?"', '', scrapedinfo) - infoformat = re.compile('(.*?</dt><dd.*?>).*?</dd><dt>', re.DOTALL).findall(scrapedinfo) - for info in infoformat: - scrapedinfo = scrapedinfo.replace(scrapedinfo, "[COLOR white][B]" + scrapedinfo + "[/COLOR]") - scrapedinfo = scrapedinfo.replace(info, "[COLOR red][B]" + info + "[/B][/COLOR]") - info = scrapedinfo - info = re.sub( - r'<a href=".*?">|title=".*?">|<span itemprop=.*?>|</span></span>|<span>|</a>|itemprop=".*?"|y otros.*?&', - '', info) - info = info.replace("</dt><dd>", ":") - info = info.replace("</dt><dd >", ":") - info = info.replace("</dt><dd > ", ":") - info = info.replace("</dd><dt>", " ") - info = info.replace("</span>", " ") - if "hellip" in data: - info = info.replace("Actores:", "[COLOR red][B]Actores:[/B][/COLOR] ") - - foto = item.category - photo = item.extra - quit = "Pulsa" + " [COLOR crimson][B]INTRO [/B][/COLOR]" + "para quitar" - - ventana2 = TextBox1(title=title, plot=plot, info=info, thumbnail=photo, fanart=foto, quit=quit) - ventana2.doModal() - - -ACTION_GESTURE_SWIPE_LEFT = 511 -ACTION_SELECT_ITEM = 7 - - -class TextBox1(xbmcgui.WindowDialog): - """ Create a skinned textbox window """ - - def __init__(self, *args, **kwargs): - - self.getTitle = kwargs.get('title') - self.getPlot = kwargs.get('plot') - self.getInfo = kwargs.get('info') - self.getThumbnail = kwargs.get('thumbnail') - self.getFanart = kwargs.get('fanart') - self.getQuit = kwargs.get('quit') - - self.background = xbmcgui.ControlImage(70, 20, 1150, 630, - 'http://s6.postimg.org/58jknrvtd/backgroundventana5.png') - self.title = xbmcgui.ControlTextBox(140, 60, 1130, 50) - self.quit = xbmcgui.ControlTextBox(145, 90, 1030, 45) - self.plot = xbmcgui.ControlTextBox(120, 150, 1056, 140) - self.info = xbmcgui.ControlFadeLabel(120, 310, 1056, 100) - self.thumbnail = xbmcgui.ControlImage(813, 43, 390, 100, self.getThumbnail) - self.fanart = xbmcgui.ControlImage(120, 365, 1060, 250, self.getFanart) - - self.addControl(self.background) - self.addControl(self.title) - self.addControl(self.quit) - self.addControl(self.plot) - self.addControl(self.thumbnail) - self.addControl(self.fanart) - self.addControl(self.info) - - self.title.setText(self.getTitle) - self.quit.setText(self.getQuit) - try: - self.plot.autoScroll(7000, 6000, 30000) - except: - ###Información de incompatibilidd autoscroll con versiones inferiores a isengrd - print "Actualice a la ultima version de kodi para mejor info" - import xbmc - xbmc.executebuiltin( - 'Notification([COLOR red][B]Actualiza Kodi a su última versión[/B][/COLOR], [COLOR skyblue]para mejor info[/COLOR],8000,"https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/kodi-icon.png")') - self.plot.setText(self.getPlot) - self.info.addLabel(self.getInfo) - - def get(self): - - self.show() - - def onAction(self, action): - if action == ACTION_SELECT_ITEM or action == ACTION_GESTURE_SWIPE_LEFT: - ###Se vuelven a cargar Customkey al salir de info - import os, sys - import xbmc - APPCOMMANDDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "customapp.xml") - NOBACKDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "noback.xml") - REMOTENOBACKDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "remotenoback.xml") - APPNOBACKDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "appnoback.xml") - TESTPYDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "test.py") - try: - os.remove(NOBACKDESTFILE) - os.remove(REMOTENOBACKDESTFILE) - os.remove(APPNOBACKDESTFILE) - if os.path.exists(TESTPYDESTFILE): - urllib.urlretrieve( - "https://raw.githubusercontent.com/neno1978/script.palc.forcerefresh/master/Bricocine/customapp.xml", - APPCOMMANDDESTFILE) - xbmc.executebuiltin('Action(reloadkeymaps)') - except: - pass - self.close() - - -def info_capitulos(item): - logger.info() - import xbmc - APPCOMMANDDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "customapp.xml") - try: - os.remove(APPCOMMANDDESTFILE) - except: - pass - url = item.url - data = scrapertools.cache_page(url) - data = re.sub(r"\n|\r|\t|\s{2}| ", "", data) - if "series" in item.category: - item.category = item.category.split("|")[0] - else: - item.category = item.show.split("|")[0] - item.thumbnail = item.show.split("|")[1] - capitulo = item.extra.split("|")[2] - capitulo = re.sub(r"(0)\d;", "", capitulo) - url = "http://thetvdb.com/api/1D62F2F90030C444/series/" + item.show.split("|")[0] + "/default/" + \ - item.extra.split("|")[0] + "/" + capitulo + "/es.xml" - data = scrapertools.cache_page(url) - data = re.sub(r"\n|\r|\t|\s{2}| ", "", data) - patron = '<Data>.*?<EpisodeName>([^<]+)</EpisodeName>.*?' - patron += '<Overview>(.*?)</Overview>.*?' - - matches = re.compile(patron, re.DOTALL).findall(data) - if len(matches) == 0: - title = "[COLOR red][B]LO SENTIMOS...[/B][/COLOR]" - plot = "Este capitulo no tiene informacion..." - plot = plot.replace(plot, "[COLOR yellow][B]" + plot + "[/B][/COLOR]") - image = "http://s6.postimg.org/ub7pb76c1/noinfo.png" - foto = "http://s6.postimg.org/nm3gk1xox/noinfosup2.png" - quit = "Pulsa" + " [COLOR greenyellow][B]INTRO [/B][/COLOR]" + "para quitar" - else: - - for name_epi, info in matches: - if "<filename>episodes" in data: - foto = scrapertools.get_match(data, '<Data>.*?<filename>(.*?)</filename>') - fanart = "http://thetvdb.com/banners/" + foto - else: - fanart = item.show.split("|")[1] - if item.show.split("|")[1] == item.thumbnail: - fanart = "http://s6.postimg.org/4asrg755b/bricotvshows2.png" - - plot = info - plot = (translate(plot, "es")) - plot = plot.replace(plot, "[COLOR yellow][B]" + plot + "[/B][/COLOR]") - name_epi = re.sub(r"&#.*?;|&", "", name_epi) - plot = re.sub(r"&#.*?;", "", plot) - title = name_epi.upper() - title = title.replace(title, "[COLOR sandybrown][B]" + title + "[/B][/COLOR]") - image = fanart - foto = item.show.split("|")[1] - if not ".png" in item.show.split("|")[1]: - foto = "http://s6.postimg.org/6flcihb69/brico1sinopsis.png" - quit = "Pulsa" + " [COLOR greenyellow][B]INTRO [/B][/COLOR]" + "para quitar" - NOBACKDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "noback.xml") - REMOTENOBACKDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "remotenoback.xml") - APPNOBACKDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "appnoback.xml") - TESTPYDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "test.py") - urllib.urlretrieve("https://raw.githubusercontent.com/neno1978/script.palc.forcerefresh/master/noback.xml", - NOBACKDESTFILE) - urllib.urlretrieve( - "https://raw.githubusercontent.com/neno1978/script.palc.forcerefresh/master/Bricocine/remotenoback.xml", - REMOTENOBACKDESTFILE) - urllib.urlretrieve( - "https://raw.githubusercontent.com/neno1978/script.palc.forcerefresh/master/appnoback.xml", - APPNOBACKDESTFILE) - xbmc.executebuiltin('Action(reloadkeymaps)') - ventana = TextBox2(title=title, plot=plot, thumbnail=image, fanart=foto, quit=quit) - ventana.doModal() - - -ACTION_GESTURE_SWIPE_LEFT = 511 -ACTION_SELECT_ITEM = 7 - - -class TextBox2(xbmcgui.WindowDialog): - """ Create a skinned textbox window """ - - def __init__(self, *args, **kwargs): - self.getTitle = kwargs.get('title') - self.getPlot = kwargs.get('plot') - self.getThumbnail = kwargs.get('thumbnail') - self.getFanart = kwargs.get('fanart') - self.getQuit = kwargs.get('quit') - - self.background = xbmcgui.ControlImage(70, 20, 1150, 630, 'http://s6.postimg.org/n3ph1uxn5/ventana.png') - self.title = xbmcgui.ControlTextBox(120, 60, 430, 50) - self.quit = xbmcgui.ControlTextBox(145, 110, 1030, 45) - self.plot = xbmcgui.ControlTextBox(120, 150, 1056, 100) - self.thumbnail = xbmcgui.ControlImage(120, 300, 1056, 300, self.getThumbnail) - self.fanart = xbmcgui.ControlImage(780, 43, 390, 100, self.getFanart) - - self.addControl(self.background) - self.addControl(self.title) - self.addControl(self.quit) - self.addControl(self.plot) - self.addControl(self.thumbnail) - self.addControl(self.fanart) - - self.title.setText(self.getTitle) - self.quit.setText(self.getQuit) - try: - self.plot.autoScroll(7000, 6000, 30000) - except: - print "Actualice a la ultima version de kodi para mejor info" - import xbmc - xbmc.executebuiltin( - 'Notification([COLOR red][B]Actualiza Kodi a su última versión[/B][/COLOR], [COLOR skyblue]para mejor info[/COLOR],8000,"https://raw.githubusercontent.com/linuxserver/docker-templates/master/linuxserver.io/img/kodi-icon.png")') - self.plot.setText(self.getPlot) - - def get(self): - self.show() - - def onAction(self, action): - if action == ACTION_SELECT_ITEM or action == ACTION_GESTURE_SWIPE_LEFT: - import os, sys - import xbmc - APPCOMMANDDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "customapp.xml") - NOBACKDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "noback.xml") - REMOTENOBACKDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "remotenoback.xml") - APPNOBACKDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "appnoback.xml") - TESTPYDESTFILE = os.path.join(xbmc.translatePath('special://userdata/keymaps'), "test.py") - try: - os.remove(NOBACKDESTFILE) - os.remove(REMOTENOBACKDESTFILE) - os.remove(APPNOBACKDESTFILE) - xbmc.executebuiltin('Action(reloadkeymaps)') - if os.path.exists(TESTPYDESTFILE): - urllib.urlretrieve( - "https://raw.githubusercontent.com/neno1978/script.palc.forcerefresh/master/Bricocine/customapp.xml", - APPCOMMANDDESTFILE) - xbmc.executebuiltin('Action(reloadkeymaps)') - except: - xbmc.executebuiltin('Action(reloadkeymaps)') - self.close() - - -def translate(to_translate, to_langage="auto", langage="auto"): - ###Traducción atraves de Google - '''Return the translation using google translate - you must shortcut the langage you define (French = fr, English = en, Spanish = es, etc...) - if you don't define anything it will detect it or use english by default - Example: - print(translate("salut tu vas bien?", "en")) - hello you alright?''' - agents = { - 'User-Agent': "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.30)"} - before_trans = 'class="t0">' - link = "http://translate.google.com/m?hl=%s&sl=%s&q=%s" % (to_langage, langage, to_translate.replace(" ", "+")) - request = urllib2.Request(link, headers=agents) - page = urllib2.urlopen(request).read() - result = page[page.find(before_trans) + len(before_trans):] - result = result.split("<")[0] - return result - - -if __name__ == '__main__': - to_translate = 'Hola como estas?' - print("%s >> %s" % (to_translate, translate(to_translate))) - print("%s >> %s" % (to_translate, translate(to_translate, 'fr'))) -# should print Hola como estas >> Hello how are you -# and Hola como estas? >> Bonjour comment allez-vous?