def free(item): logger.info("[stormtv.py] Free") storm_fanart = item.fanart storm_plot = item.plot storm_thumbnail = item.thumbnail storm_chapter = item.extra storm_show = item.show storm_channel_name = item.fulltitle storm_title = item.title free_url = item.url action = "findvideos" item = Item(channel=__channel__, url=item.url) exec "import pelisalacarta.channels." + storm_channel_name + " as channel" # El action nos devolvera el listado de posibles enlaces exec "itemlist = channel." + action + "(item)" storm_itemlist = [] # lang=1 # creamos la cadena de servidores free pat_free = "(" for fserver in servertools.FREE_SERVERS: pat_free = pat_free + fserver + "|" pat_free = pat_free[: len(pat_free) - 1] + ")" strue = 0 ltrue = 0 # Verified contendr� la lista de servidores que hemos podido comprobar verified = [] # Excluded contendr� los servidores que no podemos verificar excluded = [] excluded.append("letitbit") for item in itemlist: # Si el canal es shurweb le a�adimos (spa) if storm_channel_name == "shurweb": item.title = item.title + " (spa)" title = item.title.lower() if storm_channel_name == "seriesdanko": matches_free = re.compile(pat_free, re.DOTALL).findall(item.thumbnail) if len(matches_free) > 0: item.title = item.title + " (" + matches_free[0] + ")" else: matches_free = re.compile(pat_free, re.DOTALL).findall(title) if len(matches_free) > 0: logger.info("[stormtv.py] Free :" + item.title) vserver = matches_free[0] strue = 1 else: strue = 0 # Comprobamos el idioma if LANG != "0": if storm_channel_name == "serieonline": item.title = stormlib.audio_serieonline(item.title) elif (storm_channel_name == "seriesyonkis") or (storm_channel_name == "peliculasyonkis_generico"): item.title = stormlib.audio_seriesyonkis(item.title) patron_vos = "VOS|Sub" matches_vos = re.compile(patron_vos, re.DOTALL).findall(item.title) patron_vo = "VO(?!S)" matches_vo = re.compile(patron_vo, re.DOTALL).findall(item.title) patron_spa = "Espa" matches_spa = re.compile(patron_spa, re.DOTALL).findall(item.title) if len(matches_vos) > 0: if LANG in ["2", "4", "6", "0"]: if DEBUG: logger.info("[stormlib.py] findvideos: encontrado match vos") ltrue = 1 else: ltrue = 0 elif len(matches_vo) > 0: if LANG in ["3", "5", "6", "0"]: if DEBUG: logger.info("[stormlib.py] findvideos: encontrado match vo") ltrue = 1 else: ltrue = 0 elif len(matches_spa) > 0: if LANG in ["1", "4", "5", "0"]: if DEBUG: logger.info("[stormlib.py] findvideos: encontrado match spa") ltrue = 1 else: ltrue = 0 else: if DEBUG: logger.info("[stormlib.py] findvideos: No se ha encontrado ningun tipo.") ltrue = 1 else: ltrue = 1 if (strue == 1) & (ltrue == 1): # seriesyonkis es un poco distinto para comprobar, de momento hacemos bypass :) if (storm_channel_name <> "seriesyonkis") and (storm_channel_name <> "peliculasyonkis_generico"): if (vserver not in verified) & (vserver not in excluded): try: exec "import servers." + vserver + " as tserver" except: print "[stormtv.py] Free Verify no existe el servidor" try: data = scrapertools.cache_page(item.url) except: print "[stormtv.py] Free Verify no se puede descargar la pagina" # Shurweb y otros canales que usan la funcion generica de findvideos tienen el enlace directamente, no hay que descargar la pagina. if (storm_channel_name <> "shurweb") & (storm_channel_name <> "animeflv"): # print "dentro del if<>shurweb" try: resultado = tserver.find_videos(data) except: print "[stormtv.py] Free Verify no find_videos" try: res, test = tserver.test_video_exists(resultado[0][1]) except: print "[stormtv.py] Free Verified fallo test_video_exist " + vserver res = False else: # print "dentro del else<>shurweb" try: res, test = tserver.test_video_exists(data) except: print "[stormtv.py] Verified fallo test_video_exist " + vserver res = False if res: print ("[stormtv.py] Free Verify" + "True#" + test) item.title = "[Verificado]" + item.title verified.append(vserver) strue = 1 else: print ("[stormtv.py] findvideos false") strue = 0 if (strue == 1) & (ltrue == 1): storm_itemlist.append( Item( channel=__channel__, action="play", title=item.title, fulltitle=storm_channel_name, url=item.url, thumbnail=storm_thumbnail, plot=storm_plot, folder=False, fanart=storm_fanart, show=storm_show, extra=storm_chapter, server=item.server, ) ) # return storm_itemlist return sorted(storm_itemlist, key=lambda item: item.title, reverse=True)
def findvideos(item): logger.info("[stormtv.py] Findvideos - Filtro Idioma:" + LANG + " Filtro Servers:" + SERVERS) storm_fanart = item.fanart storm_plot = item.plot storm_thumbnail = item.thumbnail storm_chapter = item.extra storm_show = item.show storm_channel_name = item.fulltitle storm_title = item.title free_url = item.url action = "findvideos" from servers import servertools item = Item(channel=__channel__, url=item.url) exec "import pelisalacarta.channels." + storm_channel_name + " as channel" # El action nos devolvera el listado de posibles enlaces try: exec "itemlist = channel." + action + "(item)" except: # from servers import servertools itemlist = servertools.find_video_items(item) storm_itemlist = [] # lang=LANG # logger.info("[stormtv.py] Findvideos"+LANG) # creamos la cadena de servidores free pat_free = "(" for fserver in servertools.FREE_SERVERS: pat_free = pat_free + fserver + "|" pat_free = pat_free[: len(pat_free) - 1] + ")" # creamos la cadena de servidores filenium pat_filenium = "(" for filenium in servertools.FILENIUM_SERVERS: pat_filenium = pat_filenium + filenium + "|" pat_filenium = pat_filenium[: len(pat_filenium) - 1] + ")" # creamos la cadena de servidores alldebrid pat_all = "(" for all in servertools.ALLDEBRID_SERVERS: pat_all = pat_all + all + "|" pat_all = pat_all[: len(pat_all) - 1] + ")" # creamos la cadena de servidores real pat_real = "(" for real in servertools.REALDEBRID_SERVERS: pat_real = pat_real + real + "|" pat_real = pat_real[: len(pat_real) - 1] + ")" # logger.info("pat_free"+pat_free) # server=SERVERS strue = 0 ltrue = 0 verified = [] vserver = "" excluded = [] excluded.append("letitbit") for item in itemlist: # Si el canal es shurweb le a�adimos (spa) if storm_channel_name == "shurweb": item.title = item.title + " (spa)" fserver = item.server logger.info("[stormtv.py] title" + item.title) title = item.title.lower() if SERVERS != "0": if SERVERS == "1": # seriesdanko no tiene el nombre del server en el titulo, sino en el thumbnail if storm_channel_name == "seriesdanko": matches_free = re.compile(pat_free, re.DOTALL).findall(item.thumbnail) # logger.info("matches[0]"+matches_free[0]) if len(matches_free) > 0: item.title = item.title + " (" + matches_free[0] + ")" else: matches_free = re.compile(pat_free, re.DOTALL).findall(title) if len(matches_free) > 0: vserver = matches_free[0] if DEBUG: logger.info("free" + title) strue = 1 else: strue = 0 elif SERVERS == "2": if config.get_setting("fileniumpremium") == "true": if storm_channel_name == "seriesdanko": matches_filenium = re.compile(pat_filenium, re.DOTALL).findall(item.thumbnail) if len(matches_filenium) > 0: vserver = matches_filenium[0] item.title = item.title + " (" + matches_filenium[0] + ")" # logger.info("matches[0]"+matches_filenium[0]) else: # if (storm_channel_name=="seriespepito"): # matches_filenium= re.compile("Streamcloud",re.DOTALL).findall(item.title) # else: # titulo=item.title.lower() matches_filenium = re.compile(pat_filenium, re.DOTALL).findall(title) if len(matches_filenium) > 0: vserver = matches_filenium[0] if DEBUG: logger.info("Filenium" + item.title) print ("[stormtv.py] findvideos" + matches_filenium[0]) strue = 1 else: strue = 0 if config.get_setting("alldebridpremium") == "true": if storm_channel_name == "seriesdanko": matches_all = re.compile(pat_all, re.DOTALL).findall(item.thumbnail) if len(matches_all) > 0: item.title = item.title + " (" + matches_all[0] + ")" else: matches_all = re.compile(pat_all, re.DOTALL).findall(title) if len(matches_all) > 0: vserver = matches_all[0] if DEBUG: logger.info("Alldebrid" + item.title) strue = 1 else: strue = 0 if config.get_setting("realdebridpremium") == "true": if storm_channel_name == "seriesdanko": matches_real = re.compile(pat_real, re.DOTALL).findall(item.thumbnail) if len(matches_real) > 0: item.title = item.title + " (" + matches_real[0] + ")" else: matches_real = re.compile(pat_real, re.DOTALL).findall(title) if len(matches_real) > 0: vserver = matches_real[0] if DEBUG: logger.info("Real" + item.title) strue = 1 else: strue = 0 else: if DEBUG: logger.info("[stormtv.py] strue=1") strue = 1 # Comprobamos si el enlace existe # de momento solo para filenium # if (config.get_setting("fileniumpremium")=="true"): # logger.info("[stormtv.py] findvideos"+matches_filenium[0]) # exec "import servers."+matches_filenium[0]+" as tserver" # res,test= tserver.test_vide_exists(item.url) # logger.info("[stormtv.py] findvideos"+res+"#"+test) # Comprobamos el idioma if (LANG != "0") & (strue == 1): logger.info("lang=" + item.title) if storm_channel_name == "serieonline": item.title = stormlib.audio_serieonline(item.title) elif (storm_channel_name == "seriesyonkis") or (storm_channel_name == "peliculasyonkis_generico"): item.title = stormlib.audio_seriesyonkis(item.title) patron_vos = "VOS|Sub" matches_vos = re.compile(patron_vos, re.DOTALL).findall(item.title) patron_vo = "VO(?!S)" matches_vo = re.compile(patron_vo, re.DOTALL).findall(item.title) patron_spa = "Espa|spa" matches_spa = re.compile(patron_spa, re.DOTALL).findall(item.title) if len(matches_vos) > 0: if LANG in ["2", "4", "6", "0"]: if DEBUG: logger.info("[stormlib.py] findvideos: encontrado match vos") ltrue = 1 else: ltrue = 0 elif len(matches_vo) > 0: if LANG in ["3", "5", "6", "0"]: if DEBUG: logger.info("[stormlib.py] findvideos: encontrado match vo") ltrue = 1 else: ltrue = 0 elif len(matches_spa) > 0: if LANG in ["1", "4", "5", "0"]: if DEBUG: logger.info("[stormlib.py] findvideos: encontrado match spa") ltrue = 1 else: ltrue = 0 else: if DEBUG: logger.info("[stormlib.py] findvideos: No se ha encontrado ningun tipo.") ltrue = 1 else: if DEBUG: logger.info("[stormtv.py] ltrue=0") ltrue = 1 if (strue == 1) & (ltrue == 1): # seriesyonkis es un poco distinto para comprobar, de momento hacemos bypass :) if (storm_channel_name <> "seriesyonkis") and (storm_channel_name <> "peliculasyonkis_generico"): if (vserver not in verified) & (vserver not in excluded): try: exec "import servers." + vserver + " as tserver" except: print "[stormtv.py] Free Verify no existe el servidor" try: data = scrapertools.cache_page(item.url) except: print "[stormtv.py] Free Verify no se puede descargar la pagina" # Shurweb y otros canales que usan la funcion generica de findvideos tienen el enlace directamente, no hay que descargar la pagina. if (storm_channel_name <> "shurweb") & (storm_channel_name <> "animeflv"): print "dentro del if<>shurweb" try: resultado = tserver.find_videos(data) except: print "[stormtv.py] Free Verify no find_videos" try: res, test = tserver.test_video_exists(resultado[0][1]) except: print "[stormtv.py] Free Verified fallo test_video_exist " + vserver res = False else: print "dentro del else<>shurweb" try: res, test = tserver.test_video_exists(data) except: print "[stormtv.py] Verified fallo test_video_exist " + vserver res = False if res: print ("[stormtv.py] Free Verify" + "True#" + test) item.title = "[Verificado]" + item.title verified.append(vserver) strue = 1 else: print ("[stormtv.py] findvideos false") strue = 0 if (strue == 1) & (ltrue == 1): storm_itemlist.append( Item( channel=__channel__, action="play", title=item.title, fulltitle=storm_channel_name, url=item.url, thumbnail=storm_thumbnail, plot=storm_plot, folder=False, fanart=storm_fanart, show=storm_show, extra=storm_chapter, server=item.server, ) ) if SERVERS == "2": storm_itemlist.append( Item( channel=__channel__, action="free", title="Buscar gratuitos", fulltitle=storm_channel_name, url=free_url, thumbnail=storm_thumbnail, plot=storm_plot, fanart=storm_fanart, show=storm_show, extra=storm_chapter, ) ) return sorted(storm_itemlist, key=lambda item: item.title, reverse=True)