Exemplo n.º 1
0
def logIn(username="", password=""):
    cf = TidalConfig()
    if username == "" or password == "":
        print("----------------LogIn------------------")
        username = myinput("username:"******"password:"******"" and account2.errmsg != "":
            printErr(0, account.errmsg)
            return False
        elif account.errmsg != "":
            account = account2
        elif account2.errmsg != "":
            account2 = account
        cf.set_account(username, password, account.session_id,
                       account.country_code, account.user_id,
                       account2.session_id)

    Curtime = time.time()
    cf.set_lastlogintime(str(Curtime))
    return True
Exemplo n.º 2
0
def main(argv=None):
    if byCommand() is True:
        return

    print(LOG)
    cf = TidalConfig()
    if logIn(cf.username, cf.password) == False:
        while logIn("", "") == False:
            pass

    cf = TidalConfig()
    onlineVer = pipHelper.getLastVersion('tidal-dl')
    print("====================Tidal-dl========================")
    print("Output directory                 : " + cf.outputdir)
    print("Sound Quality                    : " + cf.quality)
    print("Video Resolution                 : " + cf.resolution)
    print("Download Threads                 : " + cf.threadnum)
    print("Only M4a                         : " + cf.onlym4a)
    print("Show download progress           : " + cf.showprogress +
          "(enable when threadnum=1)")
    print("Use hyphens                      : " + cf.addhyphen +
          "(between number and title)")
    print("Add year                         : " + cf.addyear +
          "(in album title)")
    print("Add explicit tag                 : " + cf.addexplicit)
    print("Playlist songs in artist folders : " + cf.plfile2arfolder +
          "(organized with artist folder)")
    print("Include singles                  : " + cf.includesingle +
          "(download artist album)")
    print("Save covers                      : " + cf.savephoto)
    print("ArtistName Before Track-Title    : " + cf.artistbeforetitle)
    print("Add ID Before AlbumFolderName    : " + cf.addAlbumidbeforefolder)
    print("Current Version                  : " + TIDAL_DL_VERSION)
    if onlineVer != None:
        print("Latest Version                   : " + onlineVer)
    print("====================================================")

    dl = Download(cf.threadnum)
    if not dl.ffmpeg.enable:
        printWarning(0, "Couldn't find ffmpeg!\n")
    while True:
        printMenu()
        strchoice, choice = printChoice2("Enter Choice:", 99)
        if choice == 0:
            return
        elif choice == 1:
            logIn()
            cf = TidalConfig()
            dl = Download(cf.threadnum)
        elif choice == 2:
            setting()
            cf = TidalConfig()
            dl = Download(cf.threadnum)
        elif choice == 3:
            dl.downloadAlbum()
        elif choice == 4:
            dl.downloadTrack()
        elif choice == 5:
            dl.downloadPlaylist()
        elif choice == 6:
            dl.downloadVideo()
        elif choice == 7:
            dl.downloadFavorite()
        elif choice == 8:
            dl.downloadArtistAlbum(cf.includesingle == "True")
        elif choice == 9:
            showConfig()
        elif choice == 10:
            setAccessToken()
            cf = TidalConfig()
            dl = Download(cf.threadnum)
        #Hidden Code For Developer [200-299]
        elif choice == 200:
            dl.downloadArtistAlbum(False)
        else:
            dl.downloadUrl(strchoice)
            dl.downloadByFile(strchoice)