Example #1
0
def principal(uri,player,image):
    torrent_folder=unicode(__addon__.getSetting('torrent_path'),'utf-8')
    destino = os.path.join( torrent_folder , "torrentin.torrent" ).decode("utf-8")
    bajado = False
    listitem = xbmcgui.ListItem(label="Torrentin", iconImage="", thumbnailImage="", path=str(sys.argv))
    xbmcplugin.setResolvedUrl(handle=int(sys.argv[1]), succeeded=True, listitem=listitem)
    if int(xbmc.getInfoLabel("System.BuildVersion" )[0:2]) >= 13:
        if uri:
            if uri.startswith("http://") or uri.startswith("https://"):
                guarda = torrents.dltorrent(uri,player,image)
                if guarda:
                    uri = "file://"+destino
                    bajado = True
                else:
                    return
            elif uri.startswith("magnet:"): copymagnet(uri,image)
#            elif uri.startswith("file://"): copytorrent(uri.replace("file://",""),image)
            if player == 0:
                if xbmcgui.Dialog().yesno("Torrentin" , torrents.torrent_info(uri , 0),"¿ Reproducir ?"): player = menu
                else: return
            if (oswin and player >=12): player = askplayer(uri,player,image)
            elif (not oswin and player==menu): player = askplayer(uri,player,image)
            if player == menu: return
            if bajado:
                applaunch(uri,player,image)
                return
            elif uri.startswith("file://"): playfile(uri,player,image)
            elif uri.startswith("magnet:"): playmagnet(uri,player,image)
            elif uri.startswith("acestream://"): playace(uri,player,image)
#            elif uri.startswith("http://") or uri.startswith("https://"): playweb(uri,player,image)  #obsoleto
            else: mensaje('Enlace no valido', 3000)
        else: mensaje('Ningun enlace a reproducir', 3000)
    else: xbmcgui.Dialog().ok("Torrentin" , "Este Add-On no funciona en versiones Frodo","Actualiza tu XBMC....")
Example #2
0
def askplayer(uri,player,image):
    torrent_folder=unicode(__addon__.getSetting('torrent_path'),'utf-8')
    torrent_folder2=unicode(__addon__.getSetting('torrent_path_tvp'),'utf-8')
    colorace = "lime"
    colornormal = "lime"
    colorall = "lime"
    guardar = True
    torr = True
    descargar = True
    tipo = "Torrent"
    if uri.startswith("magnet:"):
        colorace = "red"
        tipo = "Magnet"
    if uri.startswith("acestream://"):
        if __addon__.getSetting('aceplay') == "true": return 1
        colornormal = "red"
        guardar = False
        torr = False
        descargar = False
    try:
        if torrent_folder2 and (torrent_folder2 in uri or torrent_folder2 in image) : guardar = False 
        if not "torrentin.torrent" in uri and (torrent_folder in uri or torrent_folder in image): guardar = False
    except: pass
    info = torrents.torrent_info(uri , 0)
    players = [info]
    #players.append("[COLOR yellow]img: [/COLOR]"+image)
    if __addon__.getSetting("aces") == "true":    players.append("[COLOR " + colorace + "][engine]    AceStream[/COLOR]")
    if __addon__.getSetting("quasar") == "true": players.append("[COLOR " + colornormal + "][add-on]    Quasar[/COLOR]")
    if __addon__.getSetting("pulsar") == "true":  players.append("[COLOR " + colornormal + "][add-on]    Pulsar[/COLOR]")
    if __addon__.getSetting("yatp") == "true":     players.append("[COLOR " + colornormal + "][add-on]    Yet Another Torrent Player[/COLOR]")
    if __addon__.getSetting("tter") == "true":       players.append("[COLOR " + colorall + "][add-on]    Torrenter[/COLOR]")
    if __addon__.getSetting("kmed") == "true":   players.append("[COLOR " + colornormal + "][add-on]    KmediaTorrent[/COLOR]")
    if __addon__.getSetting("plexus") == "true": players.append("[COLOR " + colorace + "][add-on]    Plexus[/COLOR]")
    if __addon__.getSetting("xbmct") == "true":  players.append("[COLOR " + colornormal + "][add-on]    XBMCtorrent[/COLOR]")
    if __addon__.getSetting("strm") == "true":     players.append("[COLOR " + colornormal + "][add-on]    Stream[/COLOR]")
    if __addon__.getSetting("p2p") == "true":      players.append("[COLOR " + colorace + "][add-on]    p2p-Streams[/COLOR]")
    if xbmc.getCondVisibility('System.Platform.Android'): 
        if __addon__.getSetting("tvp") == "true":         players.append("[COLOR " + colornormal + "][app]          Torrent Video Player[/COLOR]")
        if __addon__.getSetting("tvpp") == "true":       players.append("[COLOR " + colornormal + "][app]          Torrent Video Player Pro[/COLOR]")
        if __addon__.getSetting("bitx") == "true":        players.append("[COLOR " + colornormal + "][app]          BitX[/COLOR]")
        if __addon__.getSetting("bfalc") == "true":      players.append("[COLOR " + colornormal + "][app]          BitFalcon[/COLOR]")
        if __addon__.getSetting("tsc") == "true":          players.append("[COLOR " + colorall + "][app]          Torrent Stream Controller[/COLOR]")
        if __addon__.getSetting("acep") == "true":       players.append("[COLOR " + colorace + "][app]          AcePlayer[/COLOR]")
        if __addon__.getSetting("mtorg") == "true":       players.append("[COLOR " + colornormal + "][app]          mTorrent (GP)[/COLOR]")
        if __addon__.getSetting("mtorm") == "true":       players.append("[COLOR " + colornormal + "][app]          mTorrent (MDC)[/COLOR]")
        if descargar and int(__addon__.getSetting("tordown")) != 0: players.append("[COLOR orange]     ----====[  Descargar con "+gestornames[0]+"  ]====----[/COLOR]")
    if guardar: players.append("[COLOR orange]     ----====[  Guardar el "+tipo+"  ]====----[/COLOR]")
    elif torr : players.append("[COLOR orange]     ----====[  Borrar el "+tipo+"  ]====----[/COLOR]")
    if "No Video" in info:
        if not xbmcgui.Dialog().yesno("Torrentin" , "                                         [COLOR red][B]¡¡¡ ATENCION !!![/COLOR][/B]","[COLOR orange]No se ha encontrado ningún archivo de video en el torrent.[/COLOR]","       [COLOR lime]¿ Quieres continuar para guardarlo o descargarlo ?[/COLOR]"): return menu
    seleccion = xbmcgui.Dialog().select("Torrentin - Seleccionar Reproductor", players)
    reproductor = players[seleccion]
    if seleccion != -1:
        if seleccion == 0:
            if xbmcgui.Dialog().yesno("Torrentin" , info,"¿ Resproducir ?"): principal(uri,player,image)
            else: return menu
        elif "]    AceStream" in reproductor: return 1
        elif "]    XBMCtorrent" in reproductor: return 2
        elif "]    Stream" in reproductor: return 3
        elif "]    KmediaTorrent" in reproductor: return 4
        elif "]    Pulsar" in reproductor: return 5
        elif "]    Quasar" in reproductor: return 6
        elif "]    p2p-Streams" in reproductor: return 7
        elif "]    Plexus" in reproductor: return 8
        elif "]    Torrenter" in reproductor: return 9
        elif "]    Yet Another" in reproductor: return 10
        elif "]          Torrent Video Player Pro" in reproductor: return 12
        elif "]          Torrent Video Player" in reproductor: return 11
        elif "]          BitX" in reproductor: return 13
        elif "]          BitFalcon" in reproductor: return 14
        elif "]          Torrent Stream Controller" in reproductor: return 15
        elif "]          AcePlayer" in reproductor: return 16
        elif "]          mTorrent (GP)" in reproductor: return 17
        elif "]          mTorrent (MDC)" in reproductor: return 18
        elif "[  Descargar" in reproductor: return 19
        elif "[  Guardar" in reproductor: guardar_torrent(uri,player,image)
        elif "[  Borrar" in reproductor:
            borrar_torrent(uri,player,image)
            return menu
        #return seleccion
        else: return menu
    else: return menu