コード例 #1
0
def main():
    if len(sys.argv) > 1:
        mainCommand()
        return

    Printf.logo()
    Printf.settings(CONF)

    checkLogin()

    onlineVer = getLastVersion('tidal-dl')
    if not isNull(onlineVer):
        icmp = cmpVersion(onlineVer, VERSION)
        if icmp > 0:
            Printf.info(LANG.PRINT_LATEST_VERSION + ' ' + onlineVer)

    while True:
        Printf.choices()
        choice = Printf.enter(LANG.PRINT_ENTER_CHOICE)
        if choice == "0":
            return
        elif choice == "1":
            checkLogin()
        elif choice == "2":
            changeSettings()
        else:
            start(USER, CONF, choice)
コード例 #2
0
 def isNeedUpdate(self):
     if self.curVer.version is None:
         return False
     if self.netVer.version is None:
         if self._getNetVerinfo() is False:
             return False
     return versionHelper.cmpVersion(self.curVer.version,
                                     self.netVer.version) < 0
コード例 #3
0
def main():
    if len(sys.argv) > 1:
        mainCommand()
        return

    Printf.logo()
    Printf.settings(CONF)

    checkLogin()

    onlineVer = getLastVersion('tidal-dl')
    if not isNull(onlineVer):
        icmp = cmpVersion(onlineVer, VERSION)
        if icmp > 0:
            Printf.info(LANG.PRINT_LATEST_VERSION + ' ' + onlineVer)

    while True:
        Printf.choices()
        raw = Printf.enter(LANG.PRINT_ENTER_CHOICE).strip()

        choice = int(re.sub('[^0-9]', '', raw))
        if choice == 0:
            return
        elif choice == 1:
            checkLogin()
        elif choice == 2:
            changeSettings()
        elif choice == 3:
            checkLogout()
        elif choice == 4:
            Printf.searchTypes()

            searchRaw = Printf.enter(LANG.PRINT_ENTER_CHOICE).strip()

            searchType = int(re.sub('[^0-9]', '', searchRaw))

            if (searchType == 3):
                searchRaw = Printf.enter("Enter a url or id: ").strip()
                start(TOKEN, CONF, searchRaw)
                return

            field = "track" if searchType == 0 else 'album' if searchType == 1 else 'playlist'

            if searchType >= 0 and searchType <= 2:
                song = Printf.enter("Enter the song name: ")
                searchTrack(TOKEN, LANG.PRINT_ENTER_CHOICE, field, song, CONF)
            else:
                os.system('clear')
                Printf.err("Invalid option!")
        else:
            os.system('clear')
            Printf.err("Invalid option!")
コード例 #4
0
def main():
    if len(sys.argv) > 1:
        mainCommand()
        return

    Printf.logo()
    Printf.settings(CONF)

    checkLogin()
    autoGetAccessToken()

    onlineVer = getLastVersion('tidal-dl')
    if not isNull(onlineVer):
        icmp = cmpVersion(onlineVer, VERSION)
        if icmp > 0:
            Printf.info(LANG.PRINT_LATEST_VERSION + ' ' + onlineVer)

    while True:
        Printf.choices()
        choice = Printf.enter(LANG.PRINT_ENTER_CHOICE)
        if choice == "0":
            return
        elif choice == "1":
            login()
        elif choice == "2":
            changeSettings()
        elif choice == "3":
            setAccessToken()
        elif choice == "4":
            #batch processing
            try:
                with open('batch.txt') as batchfile:
                    line = batchfile.readline()
                    while line:
                        if len(line.strip()) > 0:
                            print('\033[1m' + f"Batching {line.strip()}" + '\033[0m')
                            start(USER, CONF, line.strip())
                            line = batchfile.readline()
            except:
                traceback.print_exc()
        else:
            start(USER, CONF, choice)