def getplayByID(params,url,category):
    logger.info("[megalivewall.py] plyByID")
    tecleado = ""
    default = ""
    itemlist = []
    tecleado = string.upper(teclado(heading=config.get_localized_string(30405)))
    if len(tecleado)>0:
        url,thumbnail = megalive.getLiveUrl(tecleado,1)
        if len(url)>0:
            itemlist.append( Item(channel=CHANNELNAME, action="play" , title=tecleado , url=tecleado, thumbnail=thumbnail, plot="", show = tecleado, folder=False , context = True))
    return itemlist
def play(params,url,category):
    
    icon = "DefaultVideo.png"
    title = unicode( xbmc.getInfoLabel( "ListItem.Title" ), "utf-8" )
    thumbnail = urllib.unquote_plus( params.get("thumbnail") )
    plot = unicode( xbmc.getInfoLabel( "ListItem.Plot" ), "utf-8" )
    action = params.get("action")
    livelink,thumbnail = megalive.getLiveUrl(url,1)
    if len(livelink)<=0:
        
        print "Error de conexion: "+livelink
        
    else:
        if action == "play_fav":
            params["thumbnail"] = urllib.quote_plus(thumbnail)
            saveChannelFavorites(params,url,category)
        item=xbmcgui.ListItem(title, iconImage=icon, thumbnailImage=thumbnail, path=livelink)
        item.setInfo( type="Video",infoLabels={ "Title": title, "Plot": plot})
        item.setProperty('IsPlayable', 'true')
        xbmcplugin.setResolvedUrl(pluginhandle, True, item)
        'server':'Directo'
    '''
    if os.path.exists( file_path ):
        try:
            filejson = open( file_path )
            datadict = json.load(filejson)
        except ValueError, err:
            print "error: ",err        
        filejson.close();
        
    tecleado = teclado(title)
    if len(tecleado)>0:
        if len(datadict)>0:
            for count,item in enumerate(datadict):
                if repr(item["url"]) == repr(unicode(url)):
                    url2,thumbnail = megalive.getLiveUrl(url,1)
                    if len(thumbnail)>0:
                        item["thumbnail"]= unicode(thumbnail)
                    item["title"] = unicode(tecleado)
                    break
            outfile =     open(file_path,"w")
            json.dump(datadict,outfile,separators=(',',':'))
            outfile.flush()
            outfile.close()
            logger.info("Renombrado y Grabado en " + file_path)
            # refresh container so item is renamed
            xbmc.executebuiltin( "Container.Refresh" )
        
def play_fav(params,url,category):
    play(params,url,category)