def buscartrailer(params,url,category):
    print "[trailertools.py] Modulo: buscartrailer()"
    thumbnail = ""
    solo = "false"
    videotitle = title = urllib.unquote_plus( params.get("title") ).strip()
    if ":]" in videotitle:
        solo = "true"
        videotitle = re.sub("\[[^\]]+\]","",videotitle).strip()
    if config.get_localized_string(30110) in videotitle: #"Buscar trailer para"
        videotitle = videotitle.replace(config.get_localized_string(30110),"").strip()
    if config.get_localized_string(30111) in videotitle: #"Insatisfecho?, busca otra vez : "
        videotitle = videotitle.replace(config.get_localized_string(30111),"").strip()
    
        listavideos = GetTrailerbyKeyboard(videotitle.strip(),category)
    else:
        listavideos = gettrailer(videotitle.strip().strip(),category,solo)
    
    if len(listavideos)>0:
        for video in listavideos:
            titulo = video[1]
            url        = video[0]
            thumbnail  = video[2]
            duracion = video[3]
            xbmctools.addnewvideo( "trailertools" , "youtubeplay" , category , "youtube" ,  titulo , url , thumbnail , "Ver Video","",duracion )
    
    xbmctools.addnewfolder( CHANNELNAME , "buscartrailer" , category , config.get_localized_string(30111)+" "+videotitle , url , os.path.join(IMAGES_PATH, 'trailertools.png'), "" ) #"Insatisfecho?, busca otra vez : "        
    # Propiedades
    xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=category )
    xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE )
    xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
Beispiel #2
0
def buscartrailer(params,url,category):
    print "[trailertools.py] Modulo: buscartrailer()"
    thumbnail = ""
    solo = "false"
    videotitle = title = urllib.unquote_plus( params.get("title") ).strip()
    if ":]" in videotitle:
        solo = "true"
        videotitle = re.sub("\[[^\]]+\]","",videotitle).strip()
    if config.get_localized_string(30110) in videotitle: #"Buscar trailer para"
        videotitle = videotitle.replace(config.get_localized_string(30110),"").strip()
    if config.get_localized_string(30111) in videotitle: #"Insatisfecho?, busca otra vez : "
        videotitle = videotitle.replace(config.get_localized_string(30111),"").strip()
    
        listavideos = GetTrailerbyKeyboard(videotitle.strip(),category)
    else:
        listavideos = gettrailer(videotitle.strip().strip(),category,solo)
    
    if len(listavideos)>0:
        for video in listavideos:
            titulo = video[1]
            url        = video[0]
            thumbnail  = video[2]
            duracion = video[3]
            xbmctools.addnewvideo( "trailertools" , "youtubeplay" , category , "youtube" ,  titulo , url , thumbnail , "Ver Video","",duracion )
    
    xbmctools.addnewfolder( CHANNELNAME , "buscartrailer" , category , config.get_localized_string(30111)+" "+videotitle , url , os.path.join(IMAGES_PATH, 'trailertools.png'), "" ) #"Insatisfecho?, busca otra vez : "        
    # Propiedades
    xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=category )
    xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE )
    xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
def mainlist(params,url,category):
    logger.info("[trailertools.py] mainlist")
    titulo = ""
    listavideos = GetTrailerbyKeyboard(titulo,category)
    if len(listavideos)>0:
        for video in listavideos:
            titulo = video[1]
            url        = video[0]
            thumbnail  = video[2]
            xbmctools.addnewvideo( "trailertools" , "youtubeplay" , category , "Directo" ,  titulo , url , thumbnail , "Ver Video" )
            
    xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=category )
    xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE )
    xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )        
Beispiel #4
0
def mainlist(params,url,category):
    logger.info("[trailertools.py] mainlist")
    titulo = ""
    listavideos = GetTrailerbyKeyboard(titulo,category)
    if len(listavideos)>0:
        for video in listavideos:
            titulo = video[1]
            url        = video[0]
            thumbnail  = video[2]
            xbmctools.addnewvideo( "trailertools" , "youtubeplay" , category , "Directo" ,  titulo , url , thumbnail , "Ver Video" )
            
    xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=category )
    xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE )
    xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )        
def extraevideos(patronvideos,data,category,title,thumbnail,plot,servidor):
    logger.info("patron="+patronvideos)
    matches = re.compile(patronvideos,re.DOTALL).findall(data)
    scrapertools.printMatches(matches)        

    if len(matches)>0 :
        # A�ade al listado de XBMC
        if servidor == "Directo":
            if "youtube.com" in  matches[0]:
                from youtube import Extract_id
                url = Extract_id(matches[0])
                xbmctools.addnewvideo( __channel__ , "play" , category , "Youtube" , "%s [YOUTUBE]" %title , url , thumbnail , plot )
            else:
                xbmctools.addnewvideo( __channel__ , "play" , category , "Directo" , "%s [Directo]" %title, matches[0] , thumbnail , plot )

        elif servidor == "Veoh":
            from servers import veoh
            veohurl = veoh.get_video_url(matches[0])
            logger.info(" veohurl = " +veohurl)

            if len(veohurl)>0:
                if  veohurl=="http://./default.asp":
                    advertencia = xbmcgui.Dialog()
                    resultado = advertencia.ok('El Video Video' , title , 'no existe en Veoh','visite la pagina www.sonolatino.com para reportarlo' )
                    return
                logger.info(" newmatches = "+veohurl)
                xbmctools.addnewvideo( __channel__ , "play" , category , "Directo" , title, veohurl , thumbnail , plot )
            else:
                advertencia = xbmcgui.Dialog()
                resultado = advertencia.ok('El Video Video' , title , 'no existe en Veoh')
                return 

        elif servidor == "Google":
            url = "http://www.flashvideodownloader.org/download.php?u=http://video.google.com/videoplay?docid="+matches[0]
            logger.info(" Url = "+url)
            data1 = scrapertools.cachePage(url)
            newpatron = '</script>.*?<a href="(.*?)" title="Click to Download">'
            newmatches = re.compile(newpatron,re.DOTALL).findall(data1)
            if len(newmatches)>0:
                logger.info(" newmatches = "+newmatches[0])
                xbmctools.addnewvideo( __channel__ , "play" , category , "Directo" , title, newmatches[0] , thumbnail , plot )

        elif servidor == "Stagevu":
            url= "http://stagevu.com/video/"+matches[0]
            from servers import stagevu
            url = stagevu.get_video_url(url)
            
            logger.info(" url = "+url)
            
            
            videotitle = "Video en Stagevu"
            server = servidor
            xbmctools.addnewvideo( __channel__ , "play" , category , "Directo" , title.strip().replace(server,"").replace("  "," ") + " - " + videotitle , url , thumbnail , plot )
        
        elif servidor == "izlesene":
            url = "http://www.izlesene.com/actions/video/embed.php?video="+matches[0]
            data1 = scrapertools.cachePage(url)
            newpatron = "fURL=([^\&]+)\&vduration=([^\&]+)\&"
            newmatches = re.compile(newpatron,re.DOTALL).findall(data1)
            if len(newmatches)>0:
                logger.info(" izlesene furl = "+newmatches[0][0])
                url = "http://dcdn.nokta.com/%s%s" %(newmatches[0][0], "_1_5_1.xml")
                xbmctools.addnewvideo( __channel__ , "play" , category , "izlesene" , "%s (%s) [IZLESENE]" %(title,newmatches[0][1]) , url , thumbnail , plot )
        
        elif servidor == "Dailymotion":
            if "/" in matches[0]:
                idd = matches[0].split("/")
                id  = idd[len(idd)-1]
            else:
                id = matches[0]
            daily = 'http://www.dailymotion.com/video/%s'%id
            data2 = scrapertools.cachePage(daily)
            Lowres=re.compile('%22sdURL%22%3A%22(.+?)%22').findall(data2)
            if len(Lowres)>0:
                videourl = urllib.unquote(Lowres[0])
                videourl = videourl.replace("\/","/")
                
                    
                subtitle = "[FLV-Directo-Dailymotion]"
                xbmctools.addnewvideo( __channel__ , "play" , category , "Directo" , title + " - "+subtitle, videourl , thumbnail , plot )
            
            # Busca el enlace al video con formato HQ (H264)        
            Highres=re.compile('%22hqURL%22%3A%22(.+?)%22').findall(data2)
            if len(Highres)>0:
                videourl = urllib.unquote(Highres[0])
                videourl = videourl.replace("\/","/")
                
                        
                subtitle = "[h264-Directo-Dailymotion-este video no es soportado en versiones antiguas o xbox plataforma]"
                xbmctools.addnewvideo( __channel__ , "play" , category , "Directo" , title + " - "+subtitle, videourl , thumbnail , plot )
        
        elif servidor == "Vimeo":
            subtitle = "[Vimeo]"
            xbmctools.addnewvideo( __channel__ , "play" , category , "Vimeo" , title + " - "+subtitle, matches[0] , thumbnail , plot )
        ## -------------------------
        
        elif servidor == "Yahoo":
            import yahoo
            subtitle  = "[Yahoo]"
            video_url = yahoo.geturl(matches[0])
            if len(video_url)>0:
                if "rtmp" in video_url:
                    addnewvideo( __channel__ , "playRtmp" , category , "Directo" , title + " - "+subtitle, video_url , thumbnail , plot )
                else:
                    xbmctools.addnewvideo( __channel__ , "play" , category , "Directo" , title + " - "+subtitle, video_url , thumbnail , plot )
def detail(params,url,category):
    logger.info("[sonolatino.py] detail")

    title = urllib.unquote_plus( params.get("title") )
    thumbnail = urllib.unquote_plus( params.get("thumbnail") )
    # Descarga la p�gina
    data = scrapertools.cachePage(url)
    if len(thumbnail)<=0:
        patron = '<td valign="top">[^<]+<img src="([^"]+)"'
        matches = re.compile(patron,re.DOTALL).findall(data)
        if len(matches)>0:
            thumbnail = matches[0]
    print thumbnail
    thumnbail = thumbnail
    ok = "false"
    
    patrondescrip = '<td.+?class="letra">[^<]+<h3>(.*?)</td>'
    descripcion = ""
    plot = ""
    uri = url
    matches = re.compile(patrondescrip,re.DOTALL).findall(data)
    
    if len(matches)>0:
        descripcion = matches[0]
        descripcion = descripcion.replace("&nbsp;","")
        descripcion = descripcion.replace("<BR>","\n")
        #descripcion = descripcion.replace("\r","")
        #descripcion = descripcion.replace("\n"," ")
        descripcion = descripcion.replace("\t","")
        descripcion = re.sub("<[^>]+>"," ",descripcion)
#        logger.info("descripcion="+descripcion)
        descripcion = acentos(descripcion)
#        logger.info("descripcion="+descripcion)
        try :
            plot = unicode( descripcion, "utf-8" ).encode("iso-8859-1")
        except:
            plot = descripcion
    # ----------------------------------------------------------------------------
    # Busca los enlaces a los videos de : "Megavideo"
    # ------------------------------------------------------------------------------------
    listavideos = servertools.findvideos(data)

    for video in listavideos:
        videotitle = video[0]
        url1 = video[1].replace("&amp;","&")
        logger.info("url   ="+url)
        if  url.endswith(".jpg"):break
        server = video[2]
        if server=="Megavideo" or "Veoh":
            xbmctools.addnewvideo( __channel__ , "play" , category , server , title.strip().replace("(Megavideo)","").replace("  "," ") + " - " + videotitle , url1 , thumbnail , plot )
            
        else:
            xbmctools.addnewvideo( __channel__ , "play" , category , server , title.strip().replace(server,"").replace("  "," ") + " - " + videotitle , url1 , thumbnail , plot )


        
      
    # ------------------------------------------------------------------------------------
       #  ---- Extrae los videos directos ----- 

    # Extrae los enlaces a los v�deos (Directo)
    patronvideos = "file: '([^']+)'"
    servidor = "Directo"
    extraevideos(patronvideos,data,category,title,thumbnail,plot,servidor)
       # ---------------------------------------
       
    # Extrae los enlaces a los v�deos (izlesene)
    patronvideos = 'http://www.izlesene.com/.+?video=([0-9]{7})'
    servidor = "izlesene"
    extraevideos(patronvideos,data,category,title,thumbnail,plot,servidor)

       #  --- Extrae los videos de veoh  ----
    patronvideos = 'var embed_code[^>]+>   <param name="movie" value="http://www.veoh.com/static/swf/webplayer/WebPlayer.swf.*?permalinkId=(.*?)&player=videodetailsembedded&videoAutoPlay=0&id=anonymous"></param>'
    servidor = "Veoh"
    extraevideos(patronvideos,data,category,title+" - Video en  Veoh",thumbnail,plot,servidor)
       # ---------------------------------------


     
#var embed_code =  '<embed id="VideoPlayback" src="http://video.google.com/googleplayer.swf?docid=1447612366747092264&hl=en&fs=true" style="width:496px;height:401px" allowFullScreen="true" allowScriptAccess="always" type="application/x-shockwave-flash" wmode="window">  </embed>' ;

       #  --- Extrae los videos de google  ----
    patronvideos = '<embed id="VideoPlayback" src="http://video.google.com/googleplayer.swf.*?docid=(.*?)&hl=en&'
    servidor = "Google"
    extraevideos(patronvideos,data,category,title+" - [Video en google]",thumbnail,plot,servidor)
       # --------------------------------------- 

       #  --- Extrae los videos de http://n59.stagevu.com  ----
    patronvideos = '"http://.*?.stagevu.com/v/.*?/(.*?).avi"'
    servidor = "Stagevu"
    extraevideos(patronvideos,data,category,title,thumbnail,plot,servidor)
    
    #  --- Extrae los videos de dailymotion.com  ----
    patronvideos = 'value="http://www.dailymotion.com/([^"]+)"'
    
    servidor = "Dailymotion"
    extraevideos(patronvideos,data,category,title,thumbnail,plot,servidor)
    
    #  --- Extrae los videos de vimeo.com  ----
    patronvideos = "http://vimeo.com.*?clip_id=([0-9]{8})"
    servidor = "Vimeo"
    extraevideos(patronvideos,data,category,title,thumbnail,plot,servidor)
    
    #  --- Extrae los videos de yahoo.com  ----
    patronvideos = "http://.*?video.yahoo.com.*?id=([v0-9]{10})"
    servidor = "Yahoo"
    extraevideos(patronvideos,data,category,title,thumbnail,plot,servidor)
    
       # --Muestra Una opcion mas para videos documentales relacionados con el tema--
    print "esta es la url :%s" %url
    try:
            patron = "http://www.sonolatino.com.*?\_(.*?)\.html"
            matches = re.compile(patron,re.DOTALL).findall(url)
            url = uri
            titulo = "Ver Videos Relacionados"
            xbmctools.addnewfolder( __channel__ , "Relacionados" , category , titulo , url , "" , "L�sta algunos videos relacionados con el mismo video musical" )
                    
            url = "http://www.sonolatino.com/ajax.php?p=detail&do=show_more_best&vid="+matches[0]
            titulo = "Ver Videos mas vistos"
            xbmctools.addnewfolder( __channel__ , "Relacionados" , category , titulo , url , "" , "L�sta algunos mas vistos relacionados con el video musical" )
        
            titulo = "Ver Videos del mismo Artista"
            url = "http://www.sonolatino.com/ajax.php?p=detail&do=show_more_artist&vid="+matches[0]
            xbmctools.addnewfolder( __channel__ , "Relacionados" , category , titulo , url , "" , "L�sta algunos videos relacionados con el mismo Artista" )
    except:
            pass
    patron  = '<h1 class="h2_artistnuevo">([^<]+)</h1>'
    matches = re.compile(patron,re.DOTALL).findall(data)
    if len(matches)>0:
        xbmctools.addnewfolder( "trailertools" , "buscartrailer" , category , "[Buscar la cancion en Youtube:] "+matches[0] , title , os.path.join(IMAGES_PATH, 'youtube_logo.png') , "Busca el video en Youtube" )
        try:
            artista = matches[0].split("-")[0].strip()
            xbmctools.addnewfolder( "trailertools" , "buscartrailer" , category , "[Buscar artista en Youtube:] "+artista , title , os.path.join(IMAGES_PATH, 'youtube_logo.png') , "Busca el video en Youtube" )
        except:
                pass
    # Label (top-right)...
    xbmcplugin.setPluginCategory( handle=pluginhandle, category=category )
        
    # Disable sorting...
    xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE )

    # End of directory...
    xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
Beispiel #7
0
def extraevideos(patronvideos,data,category,title,thumbnail,plot,servidor):
    logger.info("patron="+patronvideos)
    matches = re.compile(patronvideos,re.DOTALL).findall(data)
    scrapertools.printMatches(matches)        

    if len(matches)>0 :
        # A�ade al listado de XBMC
        if servidor == "Directo":
            if "youtube.com" in  matches[0]:
                from youtube import Extract_id
                url = Extract_id(matches[0])
                xbmctools.addnewvideo( __channel__ , "play" , category , "Youtube" , "%s [YOUTUBE]" %title , url , thumbnail , plot )
            else:
                xbmctools.addnewvideo( __channel__ , "play" , category , "Directo" , "%s [Directo]" %title, matches[0] , thumbnail , plot )

        elif servidor == "Veoh":
            from servers import veoh
            veohurl = veoh.get_video_url(matches[0])
            logger.info(" veohurl = " +veohurl)

            if len(veohurl)>0:
                if  veohurl=="http://./default.asp":
                    advertencia = xbmcgui.Dialog()
                    resultado = advertencia.ok('El Video Video' , title , 'no existe en Veoh','visite la pagina www.sonolatino.com para reportarlo' )
                    return
                logger.info(" newmatches = "+veohurl)
                xbmctools.addnewvideo( __channel__ , "play" , category , "Directo" , title, veohurl , thumbnail , plot )
            else:
                advertencia = xbmcgui.Dialog()
                resultado = advertencia.ok('El Video Video' , title , 'no existe en Veoh')
                return 

        elif servidor == "Google":
            url = "http://www.flashvideodownloader.org/download.php?u=http://video.google.com/videoplay?docid="+matches[0]
            logger.info(" Url = "+url)
            data1 = scrapertools.cachePage(url)
            newpatron = '</script>.*?<a href="(.*?)" title="Click to Download">'
            newmatches = re.compile(newpatron,re.DOTALL).findall(data1)
            if len(newmatches)>0:
                logger.info(" newmatches = "+newmatches[0])
                xbmctools.addnewvideo( __channel__ , "play" , category , "Directo" , title, newmatches[0] , thumbnail , plot )

        elif servidor == "Stagevu":
            url= "http://stagevu.com/video/"+matches[0]
            from servers import stagevu
            url = stagevu.get_video_url(url)
            
            logger.info(" url = "+url)
            
            
            videotitle = "Video en Stagevu"
            server = servidor
            xbmctools.addnewvideo( __channel__ , "play" , category , "Directo" , title.strip().replace(server,"").replace("  "," ") + " - " + videotitle , url , thumbnail , plot )
        
        elif servidor == "izlesene":
            url = "http://www.izlesene.com/actions/video/embed.php?video="+matches[0]
            data1 = scrapertools.cachePage(url)
            newpatron = "fURL=([^\&]+)\&vduration=([^\&]+)\&"
            newmatches = re.compile(newpatron,re.DOTALL).findall(data1)
            if len(newmatches)>0:
                logger.info(" izlesene furl = "+newmatches[0][0])
                url = "http://dcdn.nokta.com/%s%s" %(newmatches[0][0], "_1_5_1.xml")
                xbmctools.addnewvideo( __channel__ , "play" , category , "izlesene" , "%s (%s) [IZLESENE]" %(title,newmatches[0][1]) , url , thumbnail , plot )
        
        elif servidor == "Dailymotion":
            if "/" in matches[0]:
                idd = matches[0].split("/")
                id  = idd[len(idd)-1]
            else:
                id = matches[0]
            daily = 'http://www.dailymotion.com/video/%s'%id
            data2 = scrapertools.cachePage(daily)
            Lowres=re.compile('%22sdURL%22%3A%22(.+?)%22').findall(data2)
            if len(Lowres)>0:
                videourl = urllib.unquote(Lowres[0])
                videourl = videourl.replace("\/","/")
                
                    
                subtitle = "[FLV-Directo-Dailymotion]"
                xbmctools.addnewvideo( __channel__ , "play" , category , "Directo" , title + " - "+subtitle, videourl , thumbnail , plot )
            
            # Busca el enlace al video con formato HQ (H264)        
            Highres=re.compile('%22hqURL%22%3A%22(.+?)%22').findall(data2)
            if len(Highres)>0:
                videourl = urllib.unquote(Highres[0])
                videourl = videourl.replace("\/","/")
                
                        
                subtitle = "[h264-Directo-Dailymotion-este video no es soportado en versiones antiguas o xbox plataforma]"
                xbmctools.addnewvideo( __channel__ , "play" , category , "Directo" , title + " - "+subtitle, videourl , thumbnail , plot )
        
        elif servidor == "Vimeo":
            subtitle = "[Vimeo]"
            xbmctools.addnewvideo( __channel__ , "play" , category , "Vimeo" , title + " - "+subtitle, matches[0] , thumbnail , plot )
        ## -------------------------
        
        elif servidor == "Yahoo":
            import yahoo
            subtitle  = "[Yahoo]"
            video_url = yahoo.geturl(matches[0])
            if len(video_url)>0:
                if "rtmp" in video_url:
                    addnewvideo( __channel__ , "playRtmp" , category , "Directo" , title + " - "+subtitle, video_url , thumbnail , plot )
                else:
                    xbmctools.addnewvideo( __channel__ , "play" , category , "Directo" , title + " - "+subtitle, video_url , thumbnail , plot )
Beispiel #8
0
def detail(params,url,category):
    logger.info("[sonolatino.py] detail")

    title = urllib.unquote_plus( params.get("title") )
    thumbnail = urllib.unquote_plus( params.get("thumbnail") )
    # Descarga la p�gina
    data = scrapertools.cachePage(url)
    if len(thumbnail)<=0:
        patron = '<td valign="top">[^<]+<img src="([^"]+)"'
        matches = re.compile(patron,re.DOTALL).findall(data)
        if len(matches)>0:
            thumbnail = matches[0]
    print thumbnail
    thumnbail = thumbnail
    ok = "false"
    
    patrondescrip = '<td.+?class="letra">[^<]+<h3>(.*?)</td>'
    descripcion = ""
    plot = ""
    uri = url
    matches = re.compile(patrondescrip,re.DOTALL).findall(data)
    
    if len(matches)>0:
        descripcion = matches[0]
        descripcion = descripcion.replace("&nbsp;","")
        descripcion = descripcion.replace("<BR>","\n")
        #descripcion = descripcion.replace("\r","")
        #descripcion = descripcion.replace("\n"," ")
        descripcion = descripcion.replace("\t","")
        descripcion = re.sub("<[^>]+>"," ",descripcion)
#        logger.info("descripcion="+descripcion)
        descripcion = acentos(descripcion)
#        logger.info("descripcion="+descripcion)
        try :
            plot = unicode( descripcion, "utf-8" ).encode("iso-8859-1")
        except:
            plot = descripcion
    # ----------------------------------------------------------------------------
    # Busca los enlaces a los videos de : "Megavideo"
    # ------------------------------------------------------------------------------------
    listavideos = servertools.findvideos(data)

    for video in listavideos:
        videotitle = video[0]
        url1 = video[1].replace("&amp;","&")
        logger.info("url   ="+url)
        if  url.endswith(".jpg"):break
        server = video[2]
        if server=="Megavideo" or "Veoh":
            xbmctools.addnewvideo( __channel__ , "play" , category , server , title.strip().replace("(Megavideo)","").replace("  "," ") + " - " + videotitle , url1 , thumbnail , plot )
            
        else:
            xbmctools.addnewvideo( __channel__ , "play" , category , server , title.strip().replace(server,"").replace("  "," ") + " - " + videotitle , url1 , thumbnail , plot )


        
      
    # ------------------------------------------------------------------------------------
       #  ---- Extrae los videos directos ----- 

    # Extrae los enlaces a los v�deos (Directo)
    patronvideos = "file: '([^']+)'"
    servidor = "Directo"
    extraevideos(patronvideos,data,category,title,thumbnail,plot,servidor)
       # ---------------------------------------
       
    # Extrae los enlaces a los v�deos (izlesene)
    patronvideos = 'http://www.izlesene.com/.+?video=([0-9]{7})'
    servidor = "izlesene"
    extraevideos(patronvideos,data,category,title,thumbnail,plot,servidor)

       #  --- Extrae los videos de veoh  ----
    patronvideos = 'var embed_code[^>]+>   <param name="movie" value="http://www.veoh.com/static/swf/webplayer/WebPlayer.swf.*?permalinkId=(.*?)&player=videodetailsembedded&videoAutoPlay=0&id=anonymous"></param>'
    servidor = "Veoh"
    extraevideos(patronvideos,data,category,title+" - Video en  Veoh",thumbnail,plot,servidor)
       # ---------------------------------------


     
#var embed_code =  '<embed id="VideoPlayback" src="http://video.google.com/googleplayer.swf?docid=1447612366747092264&hl=en&fs=true" style="width:496px;height:401px" allowFullScreen="true" allowScriptAccess="always" type="application/x-shockwave-flash" wmode="window">  </embed>' ;

       #  --- Extrae los videos de google  ----
    patronvideos = '<embed id="VideoPlayback" src="http://video.google.com/googleplayer.swf.*?docid=(.*?)&hl=en&'
    servidor = "Google"
    extraevideos(patronvideos,data,category,title+" - [Video en google]",thumbnail,plot,servidor)
       # --------------------------------------- 

       #  --- Extrae los videos de http://n59.stagevu.com  ----
    patronvideos = '"http://.*?.stagevu.com/v/.*?/(.*?).avi"'
    servidor = "Stagevu"
    extraevideos(patronvideos,data,category,title,thumbnail,plot,servidor)
    
    #  --- Extrae los videos de dailymotion.com  ----
    patronvideos = 'value="http://www.dailymotion.com/([^"]+)"'
    
    servidor = "Dailymotion"
    extraevideos(patronvideos,data,category,title,thumbnail,plot,servidor)
    
    #  --- Extrae los videos de vimeo.com  ----
    patronvideos = "http://vimeo.com.*?clip_id=([0-9]{8})"
    servidor = "Vimeo"
    extraevideos(patronvideos,data,category,title,thumbnail,plot,servidor)
    
    #  --- Extrae los videos de yahoo.com  ----
    patronvideos = "http://.*?video.yahoo.com.*?id=([v0-9]{10})"
    servidor = "Yahoo"
    extraevideos(patronvideos,data,category,title,thumbnail,plot,servidor)
    
       # --Muestra Una opcion mas para videos documentales relacionados con el tema--
    print "esta es la url :%s" %url
    try:
            patron = "http://www.sonolatino.com.*?\_(.*?)\.html"
            matches = re.compile(patron,re.DOTALL).findall(url)
            url = uri
            titulo = "Ver Videos Relacionados"
            xbmctools.addnewfolder( __channel__ , "Relacionados" , category , titulo , url , "" , "L�sta algunos videos relacionados con el mismo video musical" )
                    
            url = "http://www.sonolatino.com/ajax.php?p=detail&do=show_more_best&vid="+matches[0]
            titulo = "Ver Videos mas vistos"
            xbmctools.addnewfolder( __channel__ , "Relacionados" , category , titulo , url , "" , "L�sta algunos mas vistos relacionados con el video musical" )
        
            titulo = "Ver Videos del mismo Artista"
            url = "http://www.sonolatino.com/ajax.php?p=detail&do=show_more_artist&vid="+matches[0]
            xbmctools.addnewfolder( __channel__ , "Relacionados" , category , titulo , url , "" , "L�sta algunos videos relacionados con el mismo Artista" )
    except:
            pass
    patron  = '<h1 class="h2_artistnuevo">([^<]+)</h1>'
    matches = re.compile(patron,re.DOTALL).findall(data)
    if len(matches)>0:
        xbmctools.addnewfolder( "trailertools" , "buscartrailer" , category , "[Buscar la cancion en Youtube:] "+matches[0] , title , os.path.join(IMAGES_PATH, 'youtube_logo.png') , "Busca el video en Youtube" )
        try:
            artista = matches[0].split("-")[0].strip()
            xbmctools.addnewfolder( "trailertools" , "buscartrailer" , category , "[Buscar artista en Youtube:] "+artista , title , os.path.join(IMAGES_PATH, 'youtube_logo.png') , "Busca el video en Youtube" )
        except:
                pass
    # Label (top-right)...
    xbmcplugin.setPluginCategory( handle=pluginhandle, category=category )
        
    # Disable sorting...
    xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE )

    # End of directory...
    xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )