def do_search(sender,query="",itemtext=""): item = Item() item.deserialize(itemtext) item.title = encodingsafe(item.title) item.plot = encodingsafe(item.plot) Log("[__init__.py] do_search "+item.tostring()) dir = MediaContainer(viewGroup="InfoList") if item.channel=="buscador": exec "from pelisalacarta import buscador" exec "itemlist = buscador.do_search_results(query)" else: exec "from pelisalacarta.channels import "+item.channel exec "itemlist = "+item.channel+".search(item,texto=query)" for item in itemlist: item.title = encodingsafe(item.title) item.plot = encodingsafe(item.plot) Log("item="+item.title) if item.folder: dir.Append( Function( DirectoryItem( actionexecute, title = item.title, subtitle = "subtitle", thumb = item.thumbnail ) , itemtext = item.serialize() ) ) else: dir.Append( Function( DirectoryItem( playvideo , title=item.title, subtitle="", summary=item.plot, thumb = item.thumbnail), itemtext = item.serialize() ) ) return dir
def playvideo(sender, itemtext): Log("[__init__.py] playvideo") item = Item() item.deserialize(itemtext) dir = MediaContainer(viewGroup="InfoList") if item.action == "play": try: Log("[__init__.py] playvideo ejecutando metodo play del canal #" + item.channel + "#") exec "from tvalacarta.channels import " + item.channel exec "itemlist = " + item.channel + "." + item.action + "(item)" item = itemlist[0] item.title = encodingsafe(item.title) item.plot = encodingsafe(item.plot) except: Log("[__init__.py] playvideo error al ejecutar metodo play del canal") import sys for line in sys.exc_info(): Log("%s" % line) from core import config Log("[__init__.py] playvideo url=" + item.url + ", server=" + item.server) video_urls = [] video_password = "" url = item.url server = item.server.lower() try: # Extrae todos los enlaces posibles exec "from servers import " + server + " as server_connector" video_urls = server_connector.get_video_url(page_url=url, video_password=video_password) except: import sys for line in sys.exc_info(): Log("%s" % line) for video_url in video_urls: wait_time = 0 if video_url[1].startswith("http"): dir.Append( Function( VideoItem(playvideonormal, title="Ver " + video_url[0], subtitle="", summary="", thumb=""), mediaurl=video_url[1], ) ) else: dir.Append( Function( RTMPVideoItem(playvideonormal, title="Ver " + video_url[0], subtitle="", summary="", thumb=""), mediaurl=video_url[1], ) ) return dir
def ExtraerItem(): itemserializado = sys.argv[2].replace("?", "") item = Item() if itemserializado: item.deserialize(itemserializado) else: item = Item(channel="channelselector", action="mainlist") return item
def ExtraerItem(): itemserializado = sys.argv[2].replace("?","") item = Item() if itemserializado: item.deserialize(itemserializado) else: item = Item(channel="channelselector", action="mainlist") return item
def ExtraerItem(): logger.info("[launcher.py] - ExtraerItem") item = Item() itemserializado = sys.argv[2].replace("?","") if itemserializado: item.deserialize(itemserializado) #logger.info("[launcher.py] - ExtraerItem: " + item.tostring() ) else: item = Item(channel="channelselector", action="mainlist") return item
def ProcessRequest(Socket): sys.argv[threading.current_thread().name]={"Socket":str(Socket), "Thread": threading.current_thread()} sys.argv[str(Socket)]["Host"] = "http://"+ myip + ":" + str(PORT) MostrarInfo() ReloadModules() try: itemserializado = sys.argv[sys.argv[threading.current_thread().name]["Socket"]]["Request"] if itemserializado: item = Item() item.deserialize(itemserializado) else: item = Item(channel="channelselector", action="mainlist") logger.info("-----------------------------------------------------------------------") logger.info("Item Recibido: " + item.tostring()) logger.info("-----------------------------------------------------------------------") if (item.channel=="channelselector" and item.action=="mainlist") or (item.channel=="novedades" and item.action=="mainlist") or (item.channel=="buscador" and item.action=="mainlist") or (item.channel=="channelselector" and item.action=="channeltypes"): WindowMode = 0 elif item.channel=="channelselector" and item.action=="listchannels": WindowMode = 1 else: WindowMode = 2 itemlist = navigation.NextItem(item) if type(itemlist)==list: if not (item.channel=="channelselector" and item.action=="mainlist") and not itemlist[0].action=="go_back": itemlist.insert(0,Item(title="Atrás", action="go_back",thumbnail="%sthumb_atras.png")) for x in range(len(itemlist)): nitem, title, thumbnail = navigation.ItemInfo(item, itemlist[x], WindowMode) guitools.AddItem(nitem, title, thumbnail, WindowMode) guitools.CloseDirectory(item) del sys.argv[threading.current_thread().name] MostrarInfo() except Exception as e: import traceback from platformcode import cliente logger.error(traceback.format_exc()) from core import scrapertools patron = 'File "'+os.path.join(config.get_runtime_path(),"pelisalacarta","channels","").replace("\\","\\\\")+'([^.]+)\.py"' canal = scrapertools.find_single_match(traceback.format_exc(),patron) if canal: cliente.Dialogo().MostrarOK( "Se ha producido un error en el canal " + canal, "Esto puede ser devido a varias razones: \n - El servidor no está disponible, o no esta respondiendo.\n - Cambios en el diseño de la web.\n - Etc...\nComprueba el log para ver mas detalles del error.") else: cliente.Dialogo().MostrarOK( "Se ha producido un error en pelisalacarta", "Comprueba el log para ver mas detalles del error." ) del sys.argv[threading.current_thread().name] MostrarInfo()
def actionexecute(sender, itemtext): Log("[__init__.py] actionexecute") item = Item() item.deserialize(itemtext) Log("[__init__.py] " + item.tostring()) dir = MediaContainer(viewGroup="InfoList") if item.action == "": item.action = "mainlist" Log("[__init__.py] action=" + item.action) exec "from pelisalacarta.channels import " + item.channel if item.action == "findvideos": try: exec "itemlist = " + item.channel + "." + item.action + "(item)" except: itemlist = findvideos(item) else: exec "itemlist = " + item.channel + "." + item.action + "(item)" for item in itemlist: item.title = encodingsafe(item.title) item.plot = encodingsafe(item.plot) Log("item=" + item.tostring()) if item.folder: if item.action == "search": dir.Append( Function(InputDirectoryItem(do_search, item.title, "subtitle", "txt", thumb=item.thumbnail), itemtext=item.serialize())) else: dir.Append( Function(DirectoryItem(actionexecute, title=item.title, subtitle="subtitle", thumb=item.thumbnail), itemtext=item.serialize())) else: dir.Append( Function(DirectoryItem(playvideo, title=item.title, subtitle="", summary=item.plot, thumb=item.thumbnail), itemtext=item.serialize())) Log("[__init__.py] 5") return dir
def actionexecute(sender, itemtext): Log("[__init__.py] actionexecute") item = Item() item.deserialize(itemtext) Log("[__init__.py] " + item.tostring()) dir = MediaContainer(viewGroup="InfoList") if item.action == "": item.action = "mainlist" Log("[__init__.py] action=" + item.action) exec "from tvalacarta.channels import " + item.channel if item.action == "findvideos": try: exec "itemlist = " + item.channel + "." + item.action + "(item)" except: itemlist = findvideos(item) else: exec "itemlist = " + item.channel + "." + item.action + "(item)" for item in itemlist: item.title = encodingsafe(item.title) item.plot = encodingsafe(item.plot) Log("item=" + item.tostring()) if item.folder: if item.action == "search": dir.Append( Function( InputDirectoryItem(do_search, item.title, "subtitle", "txt", thumb=item.thumbnail), itemtext=item.serialize(), ) ) else: dir.Append( Function( DirectoryItem(actionexecute, title=item.title, subtitle="subtitle", thumb=item.thumbnail), itemtext=item.serialize(), ) ) else: dir.Append( Function( DirectoryItem(playvideo, title=item.title, subtitle="", summary=item.plot, thumb=item.thumbnail), itemtext=item.serialize(), ) ) Log("[__init__.py] 5") return dir
def ExtraerItem(): if "xbmc" in PLATFORM_NAME: itemserializado = sys.argv[2].replace("?","") elif "mediaserver" in PLATFORM_NAME: import threading itemserializado = sys.argv[sys.argv[threading.current_thread().name]["Socket"]]["Request"] item = Item() if itemserializado: item.deserialize(itemserializado) else: item = Item(channel="channelselector", action="getmainlist") return item
def LeerDescarga(Nombre, Ruta=DOWNLOAD_LIST_PATH): logger.info("[descargas.py] LeerDescarga") if usingsamba(Ruta): Archivo = samba.get_file_handle_for_reading(Nombre, Ruta) else: filepath = os.path.join( Ruta , Nombre ) Archivo = open(filepath) lines = Archivo.readlines() Archivo.close(); item = Item() item.deserialize(lines[0]) return item
def LeerDescarga(Nombre, Ruta=DOWNLOAD_LIST_PATH): logger.info("[descargas.py] LeerDescarga") if usingsamba(Ruta): Archivo = samba.get_file_handle_for_reading(Nombre, Ruta) else: filepath = os.path.join(Ruta, Nombre) Archivo = open(filepath) lines = Archivo.readlines() Archivo.close() item = Item() item.deserialize(lines[0]) return item
def extract_item_from_url(requestpath): logger.info("extract_item_from_url()") # La ruta empleada en la petición ruta = requestpath.split("?")[0] logger.info("ruta="+ruta) # El item serializado está codificado en base64 itemserializado = ruta.split("/")[2] itemserializado = itemserializado.replace("%2F","/") itemserializado = itemserializado.replace("%2f","/") logger.info("item base64="+itemserializado) import base64 item = Item() item.deserialize(base64.b64decode(itemserializado)) logger.info("item: channel="+item.channel+", action="+item.action+", title="+item.title+", url="+item.url+", server="+item.server+", category="+item.category) return item
def extract_item_from_url(requestpath): logger.info("extract_item_from_url()") # La ruta empleada en la petición ruta = requestpath.split("?")[0] logger.info("ruta=" + ruta) # El item serializado está codificado en base64 itemserializado = ruta.split("/")[2] itemserializado = itemserializado.replace("%2F", "/") itemserializado = itemserializado.replace("%2f", "/") logger.info("item base64=" + itemserializado) import base64 item = Item() item.deserialize(base64.b64decode(itemserializado)) logger.info("item: channel=" + item.channel + ", action=" + item.action + ", title=" + item.title + ", url=" + item.url + ", server=" + item.server + ", category=" + item.category) return item
def do_search(sender, query="", itemtext=""): item = Item() item.deserialize(itemtext) item.title = encodingsafe(item.title) item.plot = encodingsafe(item.plot) Log("[__init__.py] do_search " + item.tostring()) dir = MediaContainer(viewGroup="InfoList") if item.channel == "buscador": exec "from pelisalacarta import buscador" exec "itemlist = buscador.do_search_results(query)" else: exec "from pelisalacarta.channels import " + item.channel exec "itemlist = " + item.channel + ".search(item,texto=query)" for item in itemlist: item.title = encodingsafe(item.title) item.plot = encodingsafe(item.plot) Log("item=" + item.title) if item.folder: dir.Append( Function(DirectoryItem(actionexecute, title=item.title, subtitle="subtitle", thumb=item.thumbnail), itemtext=item.serialize())) else: dir.Append( Function(DirectoryItem(playvideo, title=item.title, subtitle="", summary=item.plot, thumb=item.thumbnail), itemtext=item.serialize())) return dir
def playvideo(sender, itemtext): Log("[__init__.py] playvideo") item = Item() item.deserialize(itemtext) dir = MediaContainer(viewGroup="InfoList") if item.action == "play": try: Log("[__init__.py] playvideo ejecutando metodo play del canal #" + item.channel + "#") exec "from tvalacarta.channels import " + item.channel exec "itemlist = " + item.channel + "." + item.action + "(item)" item = itemlist[0] item.title = encodingsafe(item.title) item.plot = encodingsafe(item.plot) except: Log("[__init__.py] playvideo error al ejecutar metodo play del canal" ) import sys for line in sys.exc_info(): Log("%s" % line) from core import config Log("[__init__.py] playvideo url=" + item.url + ", server=" + item.server) video_urls = [] video_password = "" url = item.url server = item.server.lower() try: # Extrae todos los enlaces posibles exec "from servers import " + server + " as server_connector" video_urls = server_connector.get_video_url( page_url=url, video_password=video_password) except: import sys for line in sys.exc_info(): Log("%s" % line) for video_url in video_urls: wait_time = 0 if video_url[1].startswith("http"): dir.Append( Function(VideoItem(playvideonormal, title="Ver " + video_url[0], subtitle="", summary="", thumb=""), mediaurl=video_url[1])) else: dir.Append( Function(RTMPVideoItem(playvideonormal, title="Ver " + video_url[0], subtitle="", summary="", thumb=""), mediaurl=video_url[1])) return dir
def ProcessRequest(Socket): sys.argv[threading.current_thread().name] = { "Socket": str(Socket), "Thread": threading.current_thread() } sys.argv[str(Socket)]["Host"] = "http://" + myip + ":" + str(PORT) MostrarInfo() ReloadModules() try: itemserializado = sys.argv[sys.argv[threading.current_thread().name] ["Socket"]]["Request"] if itemserializado: item = Item() item.deserialize(itemserializado) else: item = Item(channel="channelselector", action="mainlist") logger.info( "-----------------------------------------------------------------------" ) logger.info("Item Recibido: " + item.tostring()) logger.info( "-----------------------------------------------------------------------" ) if (item.channel == "channelselector" and item.action == "mainlist" ) or (item.channel == "novedades" and item.action == "mainlist" ) or (item.channel == "buscador" and item.action == "mainlist") or (item.channel == "channelselector" and item.action == "channeltypes"): WindowMode = 0 elif item.channel == "channelselector" and item.action == "listchannels": WindowMode = 1 else: WindowMode = 2 itemlist = navigation.NextItem(item) if type(itemlist) == list: if not (item.channel == "channelselector" and item.action == "mainlist") and not itemlist[0].action == "go_back": itemlist.insert( 0, Item(title="Atrás", action="go_back", thumbnail="%sthumb_atras.png")) for x in range(len(itemlist)): nitem, title, thumbnail = navigation.ItemInfo( item, itemlist[x], WindowMode) guitools.AddItem(nitem, title, thumbnail, WindowMode) guitools.CloseDirectory(item) del sys.argv[threading.current_thread().name] MostrarInfo() except Exception as e: import traceback from platformcode import cliente logger.error(traceback.format_exc()) from core import scrapertools patron = 'File "' + os.path.join( config.get_runtime_path(), "pelisalacarta", "channels", "").replace("\\", "\\\\") + '([^.]+)\.py"' canal = scrapertools.find_single_match(traceback.format_exc(), patron) if canal: cliente.Dialogo().MostrarOK( "Se ha producido un error en el canal " + canal, "Esto puede ser devido a varias razones: \n - El servidor no está disponible, o no esta respondiendo.\n - Cambios en el diseño de la web.\n - Etc...\nComprueba el log para ver mas detalles del error." ) else: cliente.Dialogo().MostrarOK( "Se ha producido un error en pelisalacarta", "Comprueba el log para ver mas detalles del error.") del sys.argv[threading.current_thread().name] MostrarInfo()
def canal(channel_name="", action="", caller_item_serialized=None): Log.Info("Entrando en canal para ejectuar " + channel_name + "." + action) oc = ObjectContainer(view_group="List") try: if caller_item_serialized is None: Log.Info("caller_item_serialized=None") caller_item = Item() else: Log.Info("caller_item_serialized=" + caller_item_serialized) caller_item = Item() caller_item.deserialize(caller_item_serialized) Log.Info("caller_item=" + str(caller_item)) Log.Info("Importando...") from servers import servertools channelmodule = servertools.get_channel_module(channel_name) Log.Info("Importado") Log.Info("Antes de hasattr") if hasattr(channelmodule, action): Log.Info("El módulo " + channel_name + " tiene una funcion " + action) itemlist = getattr(channelmodule, action)(caller_item) if action == "play" and len(itemlist) > 0: itemlist = play_video(itemlist[0]) else: Log.Info("El módulo " + channel_name + " *NO* tiene una funcion " + action) if action == "findvideos": Log.Info("Llamando a la funcion findvideos comun") itemlist = findvideos(caller_item) elif action == "play": itemlist = play_video(caller_item) Log.Info("Tengo un itemlist con %d elementos" % len(itemlist)) for item in itemlist: try: Log.Info("item=" + unicode(item.tostring(), "utf-8", errors="replace")) except: pass try: item.title = unicode(item.title, "utf-8", errors="replace") except: pass if action != "play": oc.add( DirectoryObject( key=Callback( canal, channel_name=channel_name, action=item.action, caller_item_serialized=item.serialize(), ), title=item.title, thumb=item.thumbnail, ) ) else: Log.Info("Llamando a la funcion play comun") """ partObject = PartObject( key = Callback(resuelve, url=item.url) ) Log.Info("partObject="+str(partObject)) mediaObject = MediaObject( parts = [ partObject ] , container = 'mp4', video_codec = VideoCodec.H264, audio_codec = AudioCodec.AAC ) Log.Info("mediaObject="+str(mediaObject)) videoClipObject = VideoClipObject(title=item.title,thumb=item.thumbnail, url=item.url, key=item.url, rating_key=item.url, items = [ mediaObject ] ) Log.Info("videoClipObject="+str(mediaObject)) """ videoClipObject = VideoClipObject( title=item.title, thumb=item.thumbnail, url="pelisalacarta://" + item.url ) oc.add(videoClipObject) except: Log.Info("Excepcion al ejecutar " + channel_name + "." + action) import traceback Log.Info("Detalles: " + traceback.format_exc()) return oc
def playvideo(sender,itemtext): Log("[__init__.py] playvideo") item = Item() item.deserialize(itemtext) dir = MediaContainer(viewGroup="InfoList") if item.action=="play": try: Log("[__init__.py] playvideo ejecutando metodo play del canal #"+item.channel+"#") exec "from pelisalacarta.channels import "+item.channel exec "itemlist = "+item.channel+"."+item.action+"(item)" item = itemlist[0] item.title = encodingsafe(item.title) item.plot = encodingsafe(item.plot) except: Log("[__init__.py] playvideo error al ejecutar metodo play del canal") import sys for line in sys.exc_info(): Log( "%s" % line ) from core import config Log("[__init__.py] playvideo url="+item.url+", server="+item.server) video_urls = [] video_password="" url = item.url server = item.server # Extrae las URL de los vídeos, y si no puedes verlo te dice el motivo from servers import servertools video_urls,puedes,motivo = servertools.resolve_video_urls_for_playing(server,url,video_password,False) # Si puedes ver el vídeo, presenta las opciones if puedes: for video_url in video_urls: if len(video_url)>2: wait_time=video_url[2] dir.Append(Function( VideoItem(playvideonormal, title="Ver el vídeo "+video_url[0]+" (Espera %d segundos)" % wait_time, subtitle="", summary="", thumb = ""), mediaurl=video_url[1] )) else: wait_time=0 dir.Append(Function( VideoItem(playvideonormal, title="Ver el vídeo "+video_url[0], subtitle="", summary="", thumb = ""), mediaurl=video_url[1] )) # Si no puedes ver el vídeo te informa else: if server!="": if "<br/>" in motivo: dir.Append(Function( VideoItem(playvideonormal, title="No puedes ver este vídeo", subtitle="", summary="No puedes ver ese vídeo porque...\n"+motivo.split("<br/>")[0]+"\n"+motivo.split("<br/>")[1]+"\n"+url, thumb = ""), mediaurl="" )) else: dir.Append(Function( VideoItem(playvideonormal, title="No puedes ver este vídeo", subtitle="", summary="No puedes ver ese vídeo porque...\n"+motivo , thumb = ""), mediaurl="" )) else: dir.Append(Function( VideoItem(playvideonormal, title="No puedes ver este vídeo", subtitle="", summary="No puedes ver ese vídeo porque...\n"+"El servidor donde está alojado no está"+"\nsoportado en pelisalacarta todavía" , thumb = ""), mediaurl="" )) ''' try: Log("megavideo="+config.get_setting("megavideopremium")) # Extrae todos los enlaces posibles exec "from servers import "+server+" as server_connector" if server=="megavideo" or server=="megaupload": video_urls = server_connector.get_video_url( page_url=url , premium=(config.get_setting("megavideopremium")=="true") , user=config.get_setting("megavideouser") , password=config.get_setting("megavideopassword"), video_password=video_password ) elif server=="fileserve": video_urls = server_connector.get_video_url( page_url=url , premium=(config.get_setting("fileservepremium")=="true") , user=config.get_setting("fileserveuser") , password=config.get_setting("fileservepassword"), video_password=video_password ) else: video_urls = server_connector.get_video_url( page_url=url , video_password=video_password ) except: import sys for line in sys.exc_info(): Log( "%s" % line ) if config.get_setting("fileniumpremium")=="true" and item.server not in ["downupload","vk","fourshared","directo","adnstream","facebook","megalive","tutv","stagevu"]: exec "from servers import filenium as gen_conector" video_gen = gen_conector.get_video_url( page_url=url , premium=(config.get_setting("fileniumpremium")=="true") , user=config.get_setting("fileniumuser") , password=config.get_setting("fileniumpassword"), video_password=video_password ) Log("[xbmctools.py] filenium url="+video_gen) video_urls.append( [ "[filenium]", video_gen ] ) ''' return dir
from core import guitools directorio = os.path.join(config.get_library_path(),"SERIES") if not os.path.exists(directorio): os.mkdir(directorio) seriesxml = os.path.join( config.get_data_path() , "series.xml" ) if os.path.exists(seriesxml): if config.get_setting("updatelibrary")=="true": logger.info("Actualizando series...") f = open(seriesxml, "r") for serie in f.readlines(): item = Item() item.deserialize(serie) carpeta=library.LimpiarNombre(item.show) ruta = os.path.join( config.get_library_path() , "SERIES" , carpeta ) logger.info("Actualizando serie: "+item.show) logger.info("Ruta: "+ruta ) if os.path.exists(ruta): try: exec "from pelisalacarta.channels import "+item.channel exec "itemlist = "+item.channel+"."+item.action+"(item)" except: import traceback logger.error(traceback.format_exc()) itemlist = [] else:
def canal(channel_name="", action="", caller_item_serialized=None): Log.Info("Entrando en canal para ejectuar " + channel_name + "." + action) oc = ObjectContainer(view_group="List") try: if caller_item_serialized is None: Log.Info("caller_item_serialized=None") caller_item = Item() else: Log.Info("caller_item_serialized=" + caller_item_serialized) caller_item = Item() caller_item.deserialize(caller_item_serialized) Log.Info("caller_item=" + str(caller_item)) Log.Info("Importando...") from servers import servertools channelmodule = servertools.get_channel_module(channel_name) Log.Info("Importado") Log.Info("Antes de hasattr") if hasattr(channelmodule, action): Log.Info("El módulo " + channel_name + " tiene una funcion " + action) itemlist = getattr(channelmodule, action)(caller_item) if action == "play" and len(itemlist) > 0: itemlist = play_video(itemlist[0]) else: Log.Info("El módulo " + channel_name + " *NO* tiene una funcion " + action) if action == "findvideos": Log.Info("Llamando a la funcion findvideos comun") itemlist = findvideos(caller_item) elif action == "play": itemlist = play_video(caller_item) Log.Info("Tengo un itemlist con %d elementos" % len(itemlist)) for item in itemlist: try: Log.Info("item=" + unicode(item.tostring(), "utf-8", errors="replace")) except: pass try: item.title = unicode(item.title, "utf-8", errors="replace") except: pass if action != "play": oc.add( DirectoryObject(key=Callback( canal, channel_name=channel_name, action=item.action, caller_item_serialized=item.serialize()), title=item.title, thumb=item.thumbnail)) else: Log.Info("Llamando a la funcion play comun") ''' partObject = PartObject( key = Callback(resuelve, url=item.url) ) Log.Info("partObject="+str(partObject)) mediaObject = MediaObject( parts = [ partObject ] , container = 'mp4', video_codec = VideoCodec.H264, audio_codec = AudioCodec.AAC ) Log.Info("mediaObject="+str(mediaObject)) videoClipObject = VideoClipObject(title=item.title,thumb=item.thumbnail, url=item.url, key=item.url, rating_key=item.url, items = [ mediaObject ] ) Log.Info("videoClipObject="+str(mediaObject)) ''' videoClipObject = VideoClipObject(title=item.title, thumb=item.thumbnail, url="pelisalacarta://" + item.url) oc.add(videoClipObject) except: Log.Info("Excepcion al ejecutar " + channel_name + "." + action) import traceback Log.Info("Detalles: " + traceback.format_exc()) return oc
def playvideo(sender, itemtext): Log("[__init__.py] playvideo") item = Item() item.deserialize(itemtext) dir = MediaContainer(viewGroup="InfoList") if item.action == "play": try: Log("[__init__.py] playvideo ejecutando metodo play del canal #" + item.channel + "#") exec "from pelisalacarta.channels import " + item.channel exec "itemlist = " + item.channel + "." + item.action + "(item)" item = itemlist[0] item.title = encodingsafe(item.title) item.plot = encodingsafe(item.plot) except: Log("[__init__.py] playvideo error al ejecutar metodo play del canal" ) import sys for line in sys.exc_info(): Log("%s" % line) from core import config Log("[__init__.py] playvideo url=" + item.url + ", server=" + item.server) video_urls = [] video_password = "" url = item.url server = item.server # Extrae las URL de los vídeos, y si no puedes verlo te dice el motivo from servers import servertools video_urls, puedes, motivo = servertools.resolve_video_urls_for_playing( server, url, video_password, False) # Si puedes ver el vídeo, presenta las opciones if puedes: for video_url in video_urls: if len(video_url) > 2: wait_time = video_url[2] dir.Append( Function(VideoItem(playvideonormal, title="Ver el vídeo " + video_url[0] + " (Espera %d segundos)" % wait_time, subtitle="", summary="", thumb=""), mediaurl=video_url[1])) else: wait_time = 0 dir.Append( Function(VideoItem(playvideonormal, title="Ver el vídeo " + video_url[0], subtitle="", summary="", thumb=""), mediaurl=video_url[1])) # Si no puedes ver el vídeo te informa else: if server != "": if "<br/>" in motivo: dir.Append( Function(VideoItem( playvideonormal, title="No puedes ver este vídeo", subtitle="", summary="No puedes ver ese vídeo porque...\n" + motivo.split("<br/>")[0] + "\n" + motivo.split("<br/>")[1] + "\n" + url, thumb=""), mediaurl="")) else: dir.Append( Function(VideoItem( playvideonormal, title="No puedes ver este vídeo", subtitle="", summary="No puedes ver ese vídeo porque...\n" + motivo, thumb=""), mediaurl="")) else: dir.Append( Function( VideoItem(playvideonormal, title="No puedes ver este vídeo", subtitle="", summary="No puedes ver ese vídeo porque...\n" + "El servidor donde está alojado no está" + "\nsoportado en pelisalacarta todavía", thumb=""), mediaurl="")) ''' try: Log("megavideo="+config.get_setting("megavideopremium")) # Extrae todos los enlaces posibles exec "from servers import "+server+" as server_connector" if server=="megavideo" or server=="megaupload": video_urls = server_connector.get_video_url( page_url=url , premium=(config.get_setting("megavideopremium")=="true") , user=config.get_setting("megavideouser") , password=config.get_setting("megavideopassword"), video_password=video_password ) elif server=="fileserve": video_urls = server_connector.get_video_url( page_url=url , premium=(config.get_setting("fileservepremium")=="true") , user=config.get_setting("fileserveuser") , password=config.get_setting("fileservepassword"), video_password=video_password ) else: video_urls = server_connector.get_video_url( page_url=url , video_password=video_password ) except: import sys for line in sys.exc_info(): Log( "%s" % line ) if config.get_setting("fileniumpremium")=="true" and item.server not in ["downupload","vk","fourshared","directo","adnstream","facebook","megalive","tutv","stagevu"]: exec "from servers import filenium as gen_conector" video_gen = gen_conector.get_video_url( page_url=url , premium=(config.get_setting("fileniumpremium")=="true") , user=config.get_setting("fileniumuser") , password=config.get_setting("fileniumpassword"), video_password=video_password ) Log("[xbmctools.py] filenium url="+video_gen) video_urls.append( [ "[filenium]", video_gen ] ) ''' return dir