Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2017
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 22.41 KB | None | 0 0
  1. # -*- coding: utf-8 -*-
  2. #------------------------------------------------------------
  3. # pelisalacarta - XBMC Plugin
  4. # Canal para newpct1
  5. # http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
  6. #------------------------------------------------------------
  7. import re
  8.  
  9. from core import config
  10. from core import httptools
  11. from core import logger
  12. from core import scrapertools
  13. from core import servertools
  14. from core.item import Item
  15.  
  16.  
  17. def mainlist(item):
  18.     logger.info()
  19.    
  20.     itemlist = []
  21.     itemlist.append( Item(channel=item.channel, action="submenu", title="Películas", url="http://www.newpct1.com/", extra="peliculas") )
  22.     itemlist.append( Item(channel=item.channel, action="submenu", title="Series", url="http://www.newpct1.com/", extra="series") )
  23.     itemlist.append( Item(channel=item.channel, action="search", title="Buscar") )
  24.    
  25.     return itemlist
  26.  
  27. def search(item,texto):
  28.     logger.info("search:" + texto)
  29.     texto = texto.replace(" ","+")
  30.     item.url = "http://www.newpct1.com/index.php?page=buscar&q=%27" + texto +"%27&ordenar=Fecha&inon=Descendente"
  31.     item.extra="buscar-list"
  32.     try:
  33.         itemlist = completo(item)
  34.  
  35.         # Esta pagina coloca a veces contenido duplicado, intentamos descartarlo
  36.         dict_aux = {}
  37.         for i in itemlist:
  38.             if not i.url in dict_aux:
  39.                 dict_aux[i.url] = i
  40.             else:
  41.                 itemlist.remove(i)
  42.  
  43.         return itemlist
  44.  
  45.  
  46.     # Se captura la excepción, para no interrumpir al buscador global si un canal falla
  47.     except:
  48.         import sys
  49.         for line in sys.exc_info():
  50.             logger.error( "%s" % line )
  51.         return []
  52.  
  53. def submenu(item):
  54.     logger.info()
  55.     itemlist=[]
  56.  
  57.     data = re.sub(r"\n|\r|\t|\s{2}|(<!--.*?-->)","",httptools.downloadpage(item.url).data)
  58.     data = unicode( data, "iso-8859-1" , errors="replace" ).encode("utf-8")
  59.  
  60.     patron = '<li><a href="http://(?:www.)?newpct1.com/'+item.extra+'/">.*?<ul>(.*?)</ul>'
  61.     data = scrapertools.get_match(data,patron)
  62.  
  63.     patron = '<a href="([^"]+)".*?>([^>]+)</a>'
  64.     matches = re.compile(patron,re.DOTALL).findall(data)
  65.  
  66.     for scrapedurl,scrapedtitle in matches:
  67.         title = scrapedtitle.strip()
  68.         url = scrapedurl
  69.  
  70.         itemlist.append( Item(channel=item.channel, action="listado" ,title=title, url=url, extra="pelilist") )
  71.         itemlist.append( Item(channel=item.channel, action="alfabeto" ,title=title+" [A-Z]", url=url, extra="pelilist") )
  72.    
  73.     return itemlist
  74.  
  75. def alfabeto(item):
  76.     logger.info()
  77.     itemlist = []
  78.  
  79.     data = re.sub(r"\n|\r|\t|\s{2}|(<!--.*?-->)","",httptools.downloadpage(item.url).data)
  80.     data = unicode( data, "iso-8859-1" , errors="replace" ).encode("utf-8")
  81.  
  82.     patron = '<ul class="alfabeto">(.*?)</ul>'
  83.     data = scrapertools.get_match(data,patron)
  84.  
  85.     patron = '<a href="([^"]+)"[^>]+>([^>]+)</a>'
  86.     matches = re.compile(patron,re.DOTALL).findall(data)
  87.  
  88.     for scrapedurl,scrapedtitle in matches:
  89.         title = scrapedtitle.upper()
  90.         url = scrapedurl
  91.  
  92.         itemlist.append( Item(channel=item.channel, action="completo" ,title=title, url=url, extra=item.extra) )
  93.  
  94.     return itemlist
  95.  
  96. def listado(item):
  97.     logger.info()
  98.     #logger.info("[newpct1.py] listado url=" + item.url)
  99.     itemlist = []
  100.    
  101.     data = re.sub(r"\n|\r|\t|\s{2}|(<!--.*?-->)","",httptools.downloadpage(item.url).data)
  102.     data = unicode( data, "iso-8859-1" , errors="replace" ).encode("utf-8")    
  103.        
  104.     patron = '<ul class="'+item.extra+'">(.*?)</ul>'
  105.     logger.debug("patron="+patron)
  106.     fichas = scrapertools.get_match(data,patron)
  107.  
  108.     #<li><a href="http://www.newpct1.com/pelicula/x-men-dias-del-futuro-pasado/ts-screener/" title="Descargar XMen Dias Del Futuro gratis"><img src="http://www.newpct1.com/pictures/f/58066_x-men-dias-del-futuro--blurayrip-ac3-5.1.jpg" width="130" height="180" alt="Descargar XMen Dias Del Futuro gratis"><h2>XMen Dias Del Futuro </h2><span>BluRayRip AC3 5.1</span></a></li>
  109.     patron  = '<li><a href="([^"]+).*?' #url
  110.     patron += 'title="([^"]+).*?' #titulo
  111.     patron += '<img src="([^"]+)"[^>]+>.*?' #thumbnail
  112.     patron += '<span>([^<]*)</span>' #calidad
  113.  
  114.     matches = re.compile(patron,re.DOTALL).findall(fichas)
  115.        
  116.     for scrapedurl,scrapedtitle,scrapedthumbnail,calidad in matches:
  117.         url = scrapedurl
  118.         title = scrapedtitle
  119.         thumbnail = scrapedthumbnail
  120.         action = "findvideos"
  121.         extra = ""
  122.        
  123.         if "1.com/series" in url:
  124.             action = "completo"
  125.             extra="serie"
  126.             context = "tvshow"
  127.            
  128.             title=scrapertools.find_single_match(title,'([^-]+)')
  129.             title= title.replace("Ver online","",1).replace("Descarga Serie HD","",1).replace("Ver en linea","",1).strip()
  130.             #logger.info("[newpct1.py] titulo="+title)
  131.             '''
  132.            if len(title)>3:    
  133.                url_i = 'http://www.newpct1.com/index.php?page=buscar&url=&letter=&q=%22' + title.replace(" ","%20") + '%22'    
  134.            else:
  135.                url_i = 'http://www.newpct1.com/index.php?page=buscar&url=&letter=&q=' + title
  136.            
  137.            if "1.com/series-hd" in url:
  138.                extra="serie-hd"
  139.                url = url_i + '&categoryID=&categoryIDR=1469&calidad=' + calidad.replace(" ","+") #DTV+720p+AC3+5.1
  140.            elif "1.com/series-vo" in url:
  141.                extra="serie-vo"
  142.                url = url_i + '&categoryID=&categoryIDR=775&calidad=' + calidad.replace(" ","+") #HDTV+720p+AC3+5.1      
  143.            elif "1.com/series/" in url:
  144.                extra="serie-tv"
  145.                url = url_i + '&categoryID=&categoryIDR=767&calidad=' + calidad.replace(" ","+")
  146.                
  147.            url += '&idioma=&ordenar=Nombre&inon=Descendente'  
  148.            '''
  149.             show = title
  150.         else:    
  151.             title= title.replace("Descargar","",1).strip()
  152.             if title.endswith("gratis"): title= title[:-7]
  153.             show = ""
  154.             context = "movie"
  155.        
  156.         context_title = scrapertools.find_single_match(url, "http://www.newpct1.com/(.*?)/(.*?)/")
  157.         if context_title:
  158.             try:
  159.                 context_title = context_title[1].replace("-"," ")
  160.                 if re.search( '\d{4}', context_title[-4:]):
  161.                     context_title = context_title[:-4]
  162.                 elif re.search( '\(\d{4}\)', context_title[-6:]):
  163.                     context_title = context_title[:-6]
  164.             except:
  165.                 context_title = title
  166.  
  167.         if item.extra!="buscar-list":
  168.             title = title + ' ' + calidad
  169.            
  170.         itemlist.append( Item(channel=item.channel, action=action, title=title, url=url, thumbnail=thumbnail, extra=extra, show=show,
  171.                               contentTitle=context_title, contentType=context, context=["buscar_trailer"]) )
  172.  
  173.     if "pagination" in data:
  174.         patron = '<ul class="pagination">(.*?)</ul>'
  175.         paginacion = scrapertools.get_match(data,patron)
  176.        
  177.         if "Next" in paginacion:
  178.             url_next_page  = scrapertools.get_match(paginacion,'<a href="([^>]+)>Next</a>')[:-1].replace(" ","%20")
  179.             itemlist.append( Item(channel=item.channel, action="listado" , title=">> Página siguiente" , url=url_next_page, extra=item.extra))            
  180.     #logger.info("[newpct1.py] listado items:" + str(len(itemlist)))
  181.     return itemlist
  182.  
  183. def completo(item):
  184.     logger.info()
  185.     itemlist = []
  186.     categoryID=""
  187.    
  188.     # Guarda el valor por si son etiquetas para que lo vea 'listadofichas'
  189.     item_extra = item.extra
  190.     item_show= item.show
  191.     item_title= item.title
  192.        
  193.     # Lee las entradas
  194.     if item_extra.startswith("serie"):
  195.         ultimo_action="get_episodios"
  196.        
  197.         if item.extra !="serie_add":
  198.             '''
  199.            # Afinar mas la busqueda
  200.            if item_extra=="serie-hd":
  201.                categoryID=buscar_en_subcategoria(item.show,'1469')
  202.            elif item_extra=="serie-vo":
  203.                categoryID=buscar_en_subcategoria(item.show,'775')
  204.            elif item_extra=="serie-tv":
  205.                categoryID=buscar_en_subcategoria(item.show,'767')
  206.            if categoryID !="":
  207.                item.url=item.url.replace("categoryID=","categoryID="+categoryID)
  208.                
  209.            #Fanart
  210.            oTvdb= TvDb()
  211.            serieID=oTvdb.get_serieId_by_title(item.show)
  212.            fanart = oTvdb.get_graphics_by_serieId(serieID)
  213.            if len(fanart)>0:
  214.                item.fanart = fanart[0]'''
  215.             try:
  216.                 from core.tmdb import Tmdb
  217.                 oTmdb= Tmdb(texto_buscado=item.show,tipo="tv",idioma_busqueda="es")
  218.                 item.fanart=oTmdb.get_backdrop()
  219.                 item.plot=oTmdb.get_sinopsis()
  220.                 print item.plot
  221.             except:
  222.                 pass
  223.         else:
  224.             item_title= item.show
  225.        
  226.         items_programas = get_episodios(item)        
  227.     else:
  228.         ultimo_action="listado"
  229.         items_programas = listado(item)
  230.        
  231.     if len(items_programas) ==0:
  232.             return itemlist # devolver lista vacia
  233.            
  234.     salir = False
  235.     while not salir:
  236.  
  237.         # Saca la URL de la siguiente página    
  238.         ultimo_item = items_programas[ len(items_programas)-1 ]
  239.        
  240.         # Páginas intermedias
  241.         if ultimo_item.action==ultimo_action:
  242.             # Quita el elemento de "Página siguiente"
  243.             ultimo_item = items_programas.pop()
  244.  
  245.             # Añade las entradas de la página a la lista completa
  246.             itemlist.extend( items_programas )
  247.    
  248.             # Carga la siguiente página
  249.             ultimo_item.extra = item_extra
  250.             ultimo_item.show = item_show
  251.             ultimo_item.title = item_title
  252.             logger.debug("url=" + ultimo_item.url)
  253.             if item_extra.startswith("serie"):
  254.                 items_programas = get_episodios(ultimo_item)
  255.             else:
  256.                 items_programas = listado(ultimo_item)
  257.                
  258.         # Última página
  259.         else:
  260.             # Añade a la lista completa y sale
  261.             itemlist.extend( items_programas )
  262.             salir = True          
  263.      
  264.     if (config.get_library_support() and len(itemlist)>0 and item.extra.startswith("serie")) :
  265.         itemlist.append( Item(channel=item.channel, title="Añadir esta serie a la biblioteca", url=item.url, action="add_serie_to_library", extra="completo###serie_add" , show= item.show))
  266.     logger.debug("items="+ str(len(itemlist)))
  267.     return itemlist
  268.    
  269. def get_episodios(item):
  270.     logger.info("url=" +item.url)  
  271.     itemlist=[]
  272.     data = re.sub(r'\n|\r|\t|\s{2}|<!--.*?-->|<i class="icon[^>]+"></i>',"",httptools.downloadpage(item.url).data)
  273.     data = unicode( data, "iso-8859-1" , errors="replace" ).encode("utf-8")
  274.    
  275.     logger.debug("data=" +data)
  276.      
  277.     patron = '<ul class="buscar-list">(.*?)</ul>'
  278.     #logger.info("[newpct1.py] patron=" + patron)
  279.    
  280.     fichas = scrapertools.get_match(data,patron)
  281.     #logger.info("[newpct1.py] matches=" + str(len(fichas)))
  282.    
  283.     #<li><a href="http://www.newpct1.com/serie/forever/capitulo-101/" title="Serie Forever 1x01"><img src="http://www.newpct1.com/pictures/c/minis/1880_forever.jpg" alt="Serie Forever 1x01"></a> <div class="info"> <a href="http://www.newpct1.com/serie/forever/capitulo-101/" title="Serie Forever 1x01"><h2 style="padding:0;">Serie <strong style="color:red;background:none;">Forever - Temporada 1 </strong> - Temporada<span style="color:red;background:none;">[ 1 ]</span>Capitulo<span style="color:red;background:none;">[ 01 ]</span><span style="color:red;background:none;padding:0px;">Espa�ol Castellano</span> Calidad <span style="color:red;background:none;">[ HDTV ]</span></h2></a> <span>27-10-2014</span> <span>450 MB</span> <span class="color"><ahref="http://www.newpct1.com/serie/forever/capitulo-101/" title="Serie Forever 1x01"> Descargar</a> </div></li>
  284.     #logger.info("[newpct1.py] get_episodios: " + fichas)
  285.     patron  = '<li[^>]*><a href="([^"]+).*?' #url
  286.     patron += '<img src="([^"]+)".*?' #thumbnail
  287.     patron += '<h2 style="padding(.*?)/h2>' #titulo, idioma y calidad
  288.    
  289.     matches = re.compile(patron,re.DOTALL).findall(fichas)
  290.     #logger.info("[newpct1.py] get_episodios matches: " + str(len(matches)))
  291.     for scrapedurl,scrapedthumbnail,scrapedinfo in matches:
  292.         try:
  293.             url = scrapedurl
  294.             if '</span>' in scrapedinfo:
  295.                 #logger.info("[newpct1.py] get_episodios: scrapedinfo="+scrapedinfo)
  296.                 try:
  297.                     #<h2 style="padding:0;">Serie <strong style="color:red;background:none;">The Big Bang Theory - Temporada 6 </strong> - Temporada<span style="color:red;background:none;">[ 6 ]</span>Capitulo<span style="color:red;background:none;">[ 03 ]</span><span style="color:red;background:none;padding:0px;">Español Castellano</span> Calidad <span style="color:red;background:none;">[ HDTV ]</span></h2>
  298.                     patron = '<span style=".*?">\[\s*(.*?)\]</span>.*?' #temporada
  299.                     patron += '<span style=".*?">\[\s*(.*?)\].*?' #capitulo
  300.                     patron += ';([^/]+)' #idioma
  301.                     info_extra = re.compile(patron, re.DOTALL).findall(scrapedinfo)
  302.                     (temporada, capitulo, idioma) = info_extra[0]
  303.  
  304.                 except:
  305.                     # <h2 style="padding:0;">Serie <strong style="color:red;background:none;">The Affair  Temporada 3 Capitulo 5</strong> - <span style="color:red;background:none;padding:0px;">Español Castellano</span> Calidad <span style="color:red;background:none;">[ HDTV ]</span></h2>
  306.                     patron = '<strong style=".*?">([^<]+).*?'  # temporada y capitulo
  307.                     patron += '<span style=".*?">([^<]+)'
  308.  
  309.                     info_extra = re.compile(patron,re.DOTALL).findall(scrapedinfo)
  310.                     (temporada_capitulo,idioma)=info_extra[0]
  311.                     if re.search(r'(?i)Capitulos', temporada_capitulo):
  312.                         temporada = scrapertools.find_single_match(temporada_capitulo, 'Temp.*?\s*([\d]+)')
  313.                         cap1, cap2 = scrapertools.find_single_match(temporada_capitulo, 'Cap.*?\s*(\d+).*?(\d+)')
  314.                         capitulo = ""
  315.                     else:
  316.                         temporada, capitulo = scrapertools.get_season_and_episode(temporada_capitulo).split('x')
  317.                
  318.                 #logger.info("[newpct1.py] get_episodios: temporada=" + temporada)
  319.                 #logger.info("[newpct1.py] get_episodios: capitulo=" + capitulo)
  320.                 logger.debug("idioma=" + idioma)
  321.                 if '">' in idioma:
  322.                     idioma= " [" + scrapertools.find_single_match(idioma,'">([^<]+)').strip() +"]"
  323.                 elif '&nbsp' in idioma:
  324.                     idioma= " [" + scrapertools.find_single_match(idioma,'&nbsp;([^<]+)').strip() +"]"
  325.                 '''else:
  326.                    idioma=""'''
  327.                 if capitulo:
  328.                     title =  item.title + " (" + temporada.strip() + "x" + capitulo.strip()  + ") " + idioma
  329.                 else:
  330.                     title = item.title + " (Del %sx%s al %sx%s) %s" % (temporada, cap1, temporada, cap2, idioma)
  331.             else:
  332.                 #<h2 style="padding:0;">The Big Bang Theory - Temporada 6 [HDTV][Cap.602][Español Castellano]</h2>
  333.                 #<h2 style="padding:0;">The Beast - Temporada 1 [HDTV] [Capítulo 13] [Español]</h2
  334.                 #<h2 style="padding:0;">The Beast - Temp.1 [DVD-DVB][Cap.103][Spanish]</h2>            
  335.                 try:
  336.                     temp ,cap = scrapertools.get_season_and_episode(scrapedinfo).split('x')
  337.                 except:
  338.                     #Formatear temporadaXepisodio
  339.                     patron= re.compile('Cap.*?\s*([\d]+)',re.IGNORECASE)
  340.                     info_extra=patron.search(scrapedinfo)
  341.                                        
  342.                     if len(str(info_extra.group(1)))>=3:
  343.                         cap=info_extra.group(1)[-2:]
  344.                         temp=info_extra.group(1)[:-2]
  345.                     else:
  346.                         cap=info_extra.group(1)
  347.                         patron='Temp.*?\s*([\d]+)'            
  348.                         temp= re.compile(patron,re.IGNORECASE).search(scrapedinfo).group(1)
  349.  
  350.                 title = item.title + " ("+ temp + 'x' + cap + ")"
  351.            
  352.             #logger.info("[newpct1.py] get_episodios: fanart= " +item.fanart)
  353.             itemlist.append( Item(channel=item.channel, action="findvideos", title=title, url=url, thumbnail=item.thumbnail, show=item.show, fanart=item.fanart) )
  354.         except:
  355.             logger.error("ERROR al añadir un episodio")
  356.     if "pagination" in data:
  357.         patron = '<ul class="pagination">(.*?)</ul>'
  358.         paginacion = scrapertools.get_match(data,patron)
  359.         #logger.info("[newpct1.py] get_episodios: paginacion= " + paginacion)
  360.         if "Next" in paginacion:
  361.             url_next_page  = scrapertools.get_match(paginacion,'<a href="([^>]+)>Next</a>')[:-1]
  362.             url_next_page= url_next_page.replace(" ","%20")
  363.             #logger.info("[newpct1.py] get_episodios: url_next_page= " + url_next_page)
  364.             itemlist.append( Item(channel=item.channel, action="get_episodios" , title=">> Página siguiente" , url=url_next_page))
  365.  
  366.     return itemlist
  367.  
  368. def buscar_en_subcategoria(titulo, categoria):
  369.     data= httptools.downloadpage("http://www.newpct1.com/pct1/library/include/ajax/get_subcategory.php", post="categoryIDR=" + categoria).data
  370.     data=data.replace("</option>"," </option>")
  371.     patron = '<option value="(\d+)">(' + titulo.replace(" ","\s").replace("(","/(").replace(")","/)") + '\s[^<]*)</option>'
  372.     logger.debug("data=" + data)
  373.     logger.debug("patron=" + patron)
  374.     matches = re.compile(patron,re.DOTALL | re.IGNORECASE).findall(data)
  375.    
  376.     if len(matches)==0: matches=[('','')]
  377.     logger.debug("resultado=" + matches [0][0])
  378.     return matches [0][0]
  379.    
  380. def findvideos(item):
  381.     logger.info()
  382.     itemlist=[]  
  383.          
  384.     ## Cualquiera de las tres opciones son válidas
  385.     #item.url = item.url.replace("1.com/","1.com/ver-online/")
  386.     #item.url = item.url.replace("1.com/","1.com/descarga-directa/")
  387.     item.url = item.url.replace("1.com/","1.com/descarga-torrent/")
  388.  
  389.     # Descarga la página
  390.     data = re.sub(r"\n|\r|\t|\s{2}|(<!--.*?-->)","",httptools.downloadpage(item.url).data)
  391.     data = unicode( data, "iso-8859-1" , errors="replace" ).encode("utf-8")
  392.    
  393.     title = scrapertools.find_single_match(data,"<h1><strong>([^<]+)</strong>[^<]+</h1>")
  394.     title+= scrapertools.find_single_match(data,"<h1><strong>[^<]+</strong>([^<]+)</h1>")
  395.     caratula = scrapertools.find_single_match(data,'<div class="entry-left">.*?src="([^"]+)"')
  396.  
  397.     #<a href="http://tumejorjuego.com/download/index.php?link=descargar-torrent/058310_yo-frankenstein-blurayrip-ac3-51.html" title="Descargar torrent de Yo Frankenstein " class="btn-torrent" target="_blank">Descarga tu Archivo torrent!</a>
  398.  
  399.     patron = '<a href="([^"]+)" title="[^"]+" class="btn-torrent" target="_blank">'
  400.  
  401.     # escraped torrent
  402.     url = scrapertools.find_single_match(data,patron)
  403.     if url!="":
  404.         itemlist.append( Item(channel=item.channel, action="play", server="torrent", title=title+" [torrent]", fulltitle=title, url=url , thumbnail=caratula, plot=item.plot, folder=False) )
  405.  
  406.     # escraped ver vídeos, descargar vídeos un link, múltiples liks
  407.     data = data.replace("'",'"')
  408.     data = data.replace('javascript:;" onClick="popup("http://www.newpct1.com/pct1/library/include/ajax/get_modallinks.php?links=',"")
  409.     data = data.replace("http://tumejorserie.com/descargar/url_encript.php?link=","")
  410.     data = data.replace("$!","#!")
  411.  
  412.     patron_descargar = '<div id="tab2"[^>]+>.*?</ul>'
  413.     patron_ver = '<div id="tab3"[^>]+>.*?</ul>'
  414.  
  415.     match_ver = scrapertools.find_single_match(data,patron_ver)
  416.     match_descargar = scrapertools.find_single_match(data,patron_descargar)
  417.  
  418.     patron = '<div class="box1"><img src="([^"]+)".*?' # logo
  419.     patron+= '<div class="box2">([^<]+)</div>'         # servidor
  420.     patron+= '<div class="box3">([^<]+)</div>'         # idioma
  421.     patron+= '<div class="box4">([^<]+)</div>'         # calidad
  422.     patron+= '<div class="box5"><a href="([^"]+)".*?'  # enlace
  423.     patron+= '<div class="box6">([^<]+)</div>'         # titulo
  424.  
  425.     enlaces_ver = re.compile(patron,re.DOTALL).findall(match_ver)
  426.     enlaces_descargar = re.compile(patron,re.DOTALL).findall(match_descargar)
  427.  
  428.     for logo, servidor, idioma, calidad, enlace, titulo in enlaces_ver:
  429.         servidor = servidor.replace("streamin","streaminto")
  430.         titulo = titulo+" ["+servidor+"]"
  431.         if servertools.is_server_enabled(servidor):
  432.             try:
  433.                 servers_module = __import__("servers."+servidor)
  434.                 server_module = getattr(servers_module,servidor)
  435.                 devuelve= server_module.find_videos(enlace)
  436.                 if devuelve:
  437.                     enlace=devuelve[0][1]
  438.                     itemlist.append( Item(fanart=item.fanart, channel=item.channel, action="play", server=servidor, title=titulo , fulltitle = item.title, url=enlace , thumbnail=logo , plot=item.plot, folder=False) )
  439.             except:
  440.                 pass
  441.        
  442.     for logo, servidor, idioma, calidad, enlace, titulo in enlaces_descargar:
  443.         servidor = servidor.replace("uploaded","uploadedto")
  444.         partes = enlace.split(" ")
  445.         p = 1
  446.         for enlace in partes:
  447.             parte_titulo = titulo+" (%s/%s)" % (p,len(partes)) + " ["+servidor+"]"
  448.             p+= 1
  449.             if servertools.is_server_enabled(servidor):
  450.                 try:
  451.                     servers_module = __import__("servers."+servidor)
  452.                     server_module = getattr(servers_module,servidor)
  453.                     devuelve= server_module.find_videos(enlace)
  454.                     if devuelve:
  455.                         enlace=devuelve[0][1]
  456.                         itemlist.append( Item(fanart=item.fanart, channel=item.channel, action="play", server=servidor, title=parte_titulo , fulltitle = item.title, url=enlace , thumbnail=logo , plot=item.plot, folder=False) )
  457.                 except:
  458.                     pass
  459.     return itemlist
  460.    
  461.    
  462. def episodios(item):
  463.     # Necesario para las actualizaciones automaticas
  464.     return completo(Item(channel=item.channel, url=item.url, show=item.show, extra= "serie_add"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement