def dellst(uri="",player="",image=""): torrent_folder=unicode(__addon__.getSetting('torrent_path'),'utf-8') if xbmcgui.Dialog().yesno("Torrentin" ," \n ¿ Borrar todas las listas M3U ?"): lst = tools.chklst() for lista in lst: os.remove(os.path.join( torrent_folder , lista )) xbmc.executebuiltin('XBMC.Container.Update(%s,"")' % os.path.join( torrent_folder , lista ) )
def lst(uri="",player="",image=""): lst = tools.chklst() img=os.path.join( __cwd__ ,"resources","images","delete.png") li = xbmcgui.ListItem("[COLOR red]Borrar todas las listas[/COLOR]",img,img) command = '%s?funcion=dellst&%s' % (sys.argv[0], sys.argv[2]) xbmcplugin.addDirectoryItem(int(sys.argv[1]), command, li, True) for lista in lst: img=os.path.join( __cwd__ ,"resources","images","m3u.png") li = xbmcgui.ListItem(lista.replace(".m3u",""),img,img) command = '%s?funcion=lst2&uri=%s&%s' % (sys.argv[0], urllib.quote_plus(lista), sys.argv[2]) xbmcplugin.addDirectoryItem(int(sys.argv[1]), command, li, True) xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_LABEL) xbmcplugin.endOfDirectory(int(sys.argv[1]))
def primer(uri,player,image): if uri: principal(uri,player,image) # if uri: # xbmc.executebuiltin('xbmc.RunPlugin("plugin://plugin.video.torrentin/?funcion=principal&' + sys.argv[2].replace("?","") + '")') torrent_folder=unicode(__addon__.getSetting('torrent_path'),'utf-8') destino = os.path.join( torrent_folder , "torrentin.torrent" ).decode("utf-8") destinomag = os.path.join( torrent_folder , "torrentin.magnet" ).decode("utf-8") if xbmc.getCondVisibility('System.HasAddon("plugin.video.pelisalacarta")'): img=xbmc.translatePath(os.path.join('special://home', 'addons', 'plugin.video.pelisalacarta','icon.png')).decode("utf-8") #img="http://media.tvalacarta.info/pelisalacarta/squares/torrent.png" if __addon__.getSetting("pelismenu") == "1": li = xbmcgui.ListItem("Ir a canales torrent de pelisalacarta",img,img) command = 'plugin://plugin.video.pelisalacarta/?action=listchannels&category=torrent&channel=channelselector' elif __addon__.getSetting("pelismenu") == "0": li = xbmcgui.ListItem("Ir a pelisalacarta",img,img) command = 'plugin://plugin.video.pelisalacarta' # command = '%s?funcion=runpelis&%s' % (sys.argv[0], sys.argv[2]) xbmcplugin.addDirectoryItem(int(sys.argv[1]), command, li, True) lst = tools.chklst() if len(lst) >=1: img=os.path.join( __cwd__ ,"resources","images","m3u.png") li = xbmcgui.ListItem("Listas AceStream M3U",img,img) command = '%s?funcion=lst&%s' % (sys.argv[0], sys.argv[2]) xbmcplugin.addDirectoryItem(int(sys.argv[1]), command, li, True) if os.path.isfile (destino): img=os.path.join( __cwd__ ,"resources","images","torrentlogo.png") # torrentin.png if os.path.isfile(os.path.join( torrent_folder , "torrentin.torrent.img")): f = open(os.path.join( torrent_folder , "torrentin.torrent.img") , "rb+") img=f.read() f.close() li = xbmcgui.ListItem("Reproducir último torrent",img,img) command = '%s?funcion=principal&uri=file://%s&image=%s' % (sys.argv[0], urllib.quote_plus(destino),urllib.quote_plus(img)) xbmcplugin.addDirectoryItem(int(sys.argv[1]), command, li, False) if os.path.isfile (destinomag): f = open(destinomag , "rb+") magnet_data=f.read() f.close() img=os.path.join( __cwd__ ,"resources","images","magnetlogo.png") if os.path.isfile(os.path.join( torrent_folder , "torrentin.magnet.img")): f = open(os.path.join( torrent_folder , "torrentin.magnet.img") , "rb+") img=f.read() f.close() li = xbmcgui.ListItem("Reproducir último magnet",img,img) command = '%s?funcion=principal&uri=%s&image=%s' % (sys.argv[0], urllib.quote_plus(magnet_data),urllib.quote_plus(img)) xbmcplugin.addDirectoryItem(int(sys.argv[1]), command, li, False) img=os.path.join( __cwd__ ,"resources","images","torrentloader.png") li = xbmcgui.ListItem("Reproducir un torrent local",img,img) command = '%s?funcion=cargarlocal&%s' % (sys.argv[0], sys.argv[2]) xbmcplugin.addDirectoryItem(int(sys.argv[1]), command, li, False) img=os.path.join( __cwd__ ,"resources","images","torrentfolder.png") li = xbmcgui.ListItem("Directorio Principal",img,img) command = '%s?funcion=browselocal&%s' % (sys.argv[0], sys.argv[2]) xbmcplugin.addDirectoryItem(int(sys.argv[1]), command, li, True) img=os.path.join( __cwd__ ,"resources","images","torrent.png") li = xbmcgui.ListItem("Directorio Secundario",img,img) command = '%s?funcion=browselocaltvp&%s' % (sys.argv[0], sys.argv[2]) xbmcplugin.addDirectoryItem(int(sys.argv[1]), command, li, True) img=os.path.join( __cwd__ ,"resources","images","settings3d.png") li = xbmcgui.ListItem("Configuración",img,img) command = '%s?funcion=settings&%s' % (sys.argv[0], sys.argv[2]) xbmcplugin.addDirectoryItem(int(sys.argv[1]), command, li, False) xbmcplugin.endOfDirectory(int(sys.argv[1]))