コード例 #1
0
 def choices():
     LANG = getLang()
     print("====================================================")
     tb = prettytable.PrettyTable()
     tb.field_names = [LANG.CHOICE, LANG.FUNCTION]
     tb.align = 'l'
     tb.set_style(prettytable.PLAIN_COLUMNS)
     tb.add_row(
         [aigpy.cmd.green(LANG.CHOICE_ENTER + " '0':"), LANG.CHOICE_EXIT])
     tb.add_row(
         [aigpy.cmd.green(LANG.CHOICE_ENTER + " '1':"), LANG.CHOICE_LOGIN])
     tb.add_row([
         aigpy.cmd.green(LANG.CHOICE_ENTER + " '2':"), LANG.CHOICE_SETTINGS
     ])
     tb.add_row(
         [aigpy.cmd.green(LANG.CHOICE_ENTER + " '3':"), LANG.CHOICE_LOGOUT])
     tb.add_row([
         aigpy.cmd.green(LANG.CHOICE_ENTER + " '4':"),
         LANG.CHOICE_SET_ACCESS_TOKEN
     ])
     tb.add_row(
         [aigpy.cmd.green(LANG.CHOICE_ENTER + " '5':"), LANG.CHOICE_APIKEY])
     tb.add_row([
         aigpy.cmd.green(LANG.CHOICE_ENTER_URLID),
         LANG.CHOICE_DOWNLOAD_BY_URL
     ])
     print(tb)
     print("====================================================")
コード例 #2
0
 def settings(data:Settings):
     LANG = getLang()
     tb = prettytable.PrettyTable()
     tb.field_names = [aigpy.cmd.green(LANG.SETTING), aigpy.cmd.green(LANG.VALUE)]
     tb.align = 'l'
     # tb.add_row(["Settings path", getSettingsPath()])
     tb.add_row([LANG.SETTING_PATH, getSettingsPath()])
     tb.add_row([LANG.SETTING_DOWNLOAD_PATH, data.downloadPath])
     tb.add_row([LANG.SETTING_ONLY_M4A, data.onlyM4a])
     # tb.add_row([LANG.SETTING_ADD_EXPLICIT_TAG, data.addExplicitTag])
     # tb.add_row([LANG.SETTING_ADD_HYPHEN, data.addHyphen])
     # tb.add_row([LANG.SETTING_ADD_YEAR, data.addYear])
     # tb.add_row([LANG.SETTING_USE_TRACK_NUM, data.useTrackNumber])
     tb.add_row([LANG.SETTING_AUDIO_QUALITY, data.audioQuality])
     tb.add_row([LANG.SETTING_VIDEO_QUALITY, data.videoQuality])
     tb.add_row([LANG.SETTING_CHECK_EXIST, data.checkExist])
     tb.add_row([LANG.SETTING_SHOW_PROGRESS, data.showProgress])
     tb.add_row([LANG.SETTING_SAVE_ALBUMINFO, data.saveAlbumInfo])
     # tb.add_row([LANG.SETTING_ARTIST_BEFORE_TITLE, data.artistBeforeTitle])
     # tb.add_row([LANG.SETTING_ALBUMID_BEFORE_FOLDER, data.addAlbumIDBeforeFolder])
     tb.add_row([LANG.SETTING_INCLUDE_EP, data.includeEP])
     tb.add_row([LANG.SETTING_SAVE_COVERS, data.saveCovers])
     tb.add_row([LANG.SETTING_LANGUAGE, getLangName(data.language)])
     tb.add_row([LANG.SETTING_USE_PLAYLIST_FOLDER, data.usePlaylistFolder])
     tb.add_row([LANG.SETTING_MULITHREAD_DOWNLOAD, data.multiThreadDownload])
     tb.add_row([LANG.SETTING_ALBUM_FOLDER_FORMAT, data.albumFolderFormat])
     tb.add_row([LANG.SETTING_TRACK_FILE_FORMAT, data.trackFileFormat])
     tb.add_row([LANG.SETTING_ADD_LYRICS, data.addLyrics])
     tb.add_row([LANG.SETTING_LYRICS_SERVER_PROXY, data.lyricsServerProxy])
     print(tb)
コード例 #3
0
 def enterLimit(string, errmsg, limit=[]):
     LANG = getLang()
     while True:
         ret = aigpy.cmd.inputLimit(aigpy.cmd.yellow(string), limit)
         if ret is None:
             print(aigpy.cmd.red(LANG.PRINT_ERR + " ") + errmsg)
         else:
             break
     return ret
コード例 #4
0
 def playlist(data):
     LANG = getLang()
     tb = prettytable.PrettyTable()
     tb.field_names = [green(LANG.MODEL_PLAYLIST_PROPERTY), green(LANG.VALUE)]
     tb.align = 'l'
     tb.add_row([LANG.MODEL_TITLE, data.title])
     tb.add_row([LANG.MODEL_TRACK_NUMBER, data.numberOfTracks])
     tb.add_row([LANG.MODEL_VIDEO_NUMBER, data.numberOfVideos])
     print(tb)
コード例 #5
0
 def artist(data):
     LANG = getLang()
     tb = prettytable.PrettyTable()
     tb.field_names = [green(LANG.MODEL_ARTIST_PROPERTY), green(LANG.VALUE)]
     tb.align = 'l'
     tb.add_row([LANG.MODEL_ID, data.id])
     tb.add_row([LANG.MODEL_NAME, data.name])
     tb.add_row([LANG.MODEL_TYPE, str(data.type)])
     print(tb)
コード例 #6
0
 def video(data):
     LANG = getLang()
     tb = prettytable.PrettyTable()
     tb.field_names = [green(LANG.MODEL_VIDEO_PROPERTY), green(LANG.VALUE)]
     tb.align = 'l'
     tb.add_row([LANG.MODEL_TITLE, data.title])
     tb.add_row([LANG.MODEL_ALBUM, data.album.title if data.album != None else None])
     tb.add_row([LANG.MODEL_VERSION, data.version])
     tb.add_row([LANG.MODEL_EXPLICIT, data.explicit])
     print(tb)
コード例 #7
0
 def track(data: Track):
     LANG = getLang()
     tb = prettytable.PrettyTable()
     tb.field_names = [green(LANG.MODEL_TRACK_PROPERTY), green(LANG.VALUE)]
     tb.align = 'l'
     tb.add_row([LANG.MODEL_TITLE, data.title])
     tb.add_row(["ID", data.id])
     tb.add_row([LANG.MODEL_ALBUM, data.album.title])
     tb.add_row([LANG.MODEL_VERSION, data.version])
     tb.add_row([LANG.MODEL_EXPLICIT, data.explicit])
     print(tb)
コード例 #8
0
 def enterPath(string, errmsg, retWord = '0', default = ""):
     LANG = getLang()
     while True:
         ret = aigpy.cmd.inputPath(aigpy.cmd.yellow(string), retWord)
         if ret == retWord:
             return default
         elif ret == "":
             print(aigpy.cmd.red(LANG.PRINT_ERR + " ") + errmsg)
         else:
             break
     return ret
コード例 #9
0
 def album(data):
     LANG = getLang()
     tb = prettytable.PrettyTable()
     tb.field_names = [green(LANG.MODEL_ALBUM_PROPERTY), green(LANG.VALUE)]
     tb.align = 'l'
     tb.add_row([LANG.MODEL_TITLE, data.title])
     tb.add_row([LANG.MODEL_TRACK_NUMBER, data.numberOfTracks])
     tb.add_row([LANG.MODEL_VIDEO_NUMBER, data.numberOfVideos])
     tb.add_row([LANG.MODEL_RELEASE_DATE, data.releaseDate])
     tb.add_row([LANG.MODEL_VERSION, data.version])
     tb.add_row([LANG.MODEL_EXPLICIT, data.explicit])
     print(tb)
コード例 #10
0
 def searchTypes():
     LANG = getLang()
     print("====================================================")
     tb = prettytable.PrettyTable()
     tb.field_names = [LANG.CHOICE, "SEARCH BY"]
     tb.align = 'l'
     tb.set_style(prettytable.PLAIN_COLUMNS)
     tb.add_row([green(LANG.CHOICE_ENTER + " '0':"), "Track"])
     tb.add_row([green(LANG.CHOICE_ENTER + " '1':"), "Album"])
     tb.add_row([green(LANG.CHOICE_ENTER + " '2':"), "Playlist"])
     tb.add_row([green(LANG.CHOICE_ENTER + " '3':"), "Url/ID"])
     print(tb)
     print("====================================================")
コード例 #11
0
 def artist(data:Artist, num):
     LANG = getLang()
     tb = prettytable.PrettyTable()
     tb.field_names = [aigpy.cmd.green(LANG.MODEL_ARTIST_PROPERTY), aigpy.cmd.green(LANG.VALUE)]
     tb.align = 'l'
     tb.add_row([LANG.MODEL_ID, data.id])
     tb.add_row([LANG.MODEL_NAME, data.name])
     tb.add_row(["Number of albums", num])
     tb.add_row([LANG.MODEL_TYPE, str(data.type)])
     print(tb)
     logging.info("====artist " + str(data.id) + "====\n" +
                  "name:" + data.name + "\n" +
                  "album num:" + str(num) + "\n" +
                  "==================================")
コード例 #12
0
 def playlist(data):
     LANG = getLang()
     tb = prettytable.PrettyTable()
     tb.field_names = [aigpy.cmd.green(LANG.MODEL_PLAYLIST_PROPERTY), aigpy.cmd.green(LANG.VALUE)]
     tb.align = 'l'
     tb.add_row([LANG.MODEL_TITLE, data.title])
     tb.add_row([LANG.MODEL_TRACK_NUMBER, data.numberOfTracks])
     tb.add_row([LANG.MODEL_VIDEO_NUMBER, data.numberOfVideos])
     print(tb)
     logging.info("====playlist " + str(data.uuid) + "====\n" +
                  "title:" + data.title + "\n" +
                  "track num:" + str(data.numberOfTracks) + "\n" +
                  "video num:" + str(data.numberOfVideos) + "\n" +
                  "==================================")
コード例 #13
0
 def mix(data):
     LANG = getLang()
     tb = prettytable.PrettyTable()
     tb.field_names = [
         aigpy.cmd.green(LANG.MODEL_PLAYLIST_PROPERTY),
         aigpy.cmd.green(LANG.VALUE)
     ]
     tb.align = 'l'
     tb.add_row([LANG.MODEL_ID, data.id])
     tb.add_row([LANG.MODEL_TRACK_NUMBER, len(data.tracks)])
     tb.add_row([LANG.MODEL_VIDEO_NUMBER, len(data.videos)])
     print(tb)
     logging.info("====Mix " + str(data.id) + "====\n" + "track num:" +
                  str(len(data.tracks)) + "\n" + "video num:" +
                  str(len(data.videos)) + "\n" +
                  "==================================")
コード例 #14
0
 def video(data):
     LANG = getLang()
     tb = prettytable.PrettyTable()
     tb.field_names = [
         aigpy.cmd.green(LANG.MODEL_VIDEO_PROPERTY),
         aigpy.cmd.green(LANG.VALUE)
     ]
     tb.align = 'l'
     tb.add_row([LANG.MODEL_TITLE, data.title])
     tb.add_row([
         LANG.MODEL_ALBUM, data.album.title if data.album != None else None
     ])
     tb.add_row([LANG.MODEL_VERSION, data.version])
     tb.add_row([LANG.MODEL_EXPLICIT, data.explicit])
     print(tb)
     logging.info("====video " + str(data.id) + "====\n" + "title:" +
                  data.title + "\n" + "version:" + str(data.version) +
                  "\n" + "==================================")
コード例 #15
0
 def album(data: Album):
     LANG = getLang()
     tb = prettytable.PrettyTable()
     tb.field_names = [aigpy.cmd.green(LANG.MODEL_ALBUM_PROPERTY), aigpy.cmd.green(LANG.VALUE)]
     tb.align = 'l'
     tb.add_row([LANG.MODEL_TITLE, data.title])
     tb.add_row(["ID", data.id])
     tb.add_row([LANG.MODEL_TRACK_NUMBER, data.numberOfTracks])
     tb.add_row([LANG.MODEL_VIDEO_NUMBER, data.numberOfVideos])
     tb.add_row([LANG.MODEL_RELEASE_DATE, data.releaseDate])
     tb.add_row([LANG.MODEL_VERSION, data.version])
     tb.add_row([LANG.MODEL_EXPLICIT, data.explicit])
     print(tb)
     logging.info("====album " + str(data.id) + "====\n" +
                  "title:" + data.title + "\n" + 
                  "track num:" + str(data.numberOfTracks) + "\n" + 
                  "video num:" + str(data.numberOfVideos) + "\n" +
                  "==================================")
コード例 #16
0
 def track(data: Track):
     LANG = getLang()
     tb = prettytable.PrettyTable()
     tb.field_names = [
         aigpy.cmd.green(LANG.MODEL_TRACK_PROPERTY),
         aigpy.cmd.green(LANG.VALUE)
     ]
     tb.align = 'l'
     tb.add_row([LANG.MODEL_TITLE, data.title])
     tb.add_row(["ID", data.id])
     tb.add_row([LANG.MODEL_ALBUM, data.album.title])
     tb.add_row([LANG.MODEL_VERSION, data.version])
     tb.add_row([LANG.MODEL_EXPLICIT, data.explicit])
     print(tb)
     logging.info("====track " + str(data.id) + "====\n" + \
                  "title:" + data.title + "\n" + \
                  "version:" + str(data.version) + "\n" + \
                  "==================================")
コード例 #17
0
    def apikeys(items):
        print("-------------API-KEYS---------------")
        LANG = getLang()
        tb = prettytable.PrettyTable()
        tb.field_names = [
            aigpy.cmd.green('Index'),
            aigpy.cmd.green('Valid'),
            aigpy.cmd.green('Platform'),
            aigpy.cmd.green('Formats'),
        ]
        tb.align = 'l'

        for index, item in enumerate(items):
            tb.add_row([
                str(index),
                aigpy.cmd.green('True') if item["valid"] == "True" else
                aigpy.cmd.red('False'), item["platform"], item["formats"]
            ])
        print(tb)
コード例 #18
0
    def video(data:Video, stream:VideoStreamUrl = None):
        LANG = getLang()
        tb = prettytable.PrettyTable()
        tb.field_names = [aigpy.cmd.green(LANG.MODEL_VIDEO_PROPERTY), aigpy.cmd.green(LANG.VALUE)]
        tb.align = 'l'
        tb.add_row([LANG.MODEL_TITLE, data.title])
        tb.add_row([LANG.MODEL_ALBUM, data.album.title if data.album != None else None])
        tb.add_row([LANG.MODEL_VERSION, data.version])
        tb.add_row([LANG.MODEL_EXPLICIT, data.explicit])
        tb.add_row(["Max-Q", data.quality])
        if stream is not None:
            tb.add_row(["Get-Q", str(stream.resolution)])
            tb.add_row(["Get-Codec", str(stream.codec)])

        print(tb)
        logging.info("====video " + str(data.id) + "====\n" +
                     "title:" + data.title + "\n" +
                     "version:" + str(data.version) + "\n" +
                     "==================================")
コード例 #19
0
 def track(data:Track, stream:StreamUrl = None):
     LANG = getLang()
     tb = prettytable.PrettyTable()
     tb.field_names = [aigpy.cmd.green(LANG.MODEL_TRACK_PROPERTY), aigpy.cmd.green(LANG.VALUE)]
     tb.align = 'l'
     tb.add_row([LANG.MODEL_TITLE, data.title])
     tb.add_row(["ID", data.id])
     tb.add_row([LANG.MODEL_ALBUM, data.album.title])
     tb.add_row([LANG.MODEL_VERSION, data.version])
     tb.add_row([LANG.MODEL_EXPLICIT, data.explicit])
     tb.add_row(["Max-Q", data.audioQuality])
     if stream is not None:
         tb.add_row(["Get-Q", str(stream.soundQuality)])
         tb.add_row(["Get-Codec", str(stream.codec)])
     print(tb)
     logging.info("====track " + str(data.id) + "====\n" + \
                  "title:" + data.title + "\n" + \
                  "version:" + str(data.version) + "\n" + \
                  "==================================")
コード例 #20
0
 def settings(data):
     LANG = getLang()
     tb = prettytable.PrettyTable()
     tb.field_names = [green(LANG.SETTING), green(LANG.VALUE)]
     tb.align = 'l'
     tb.add_row([LANG.SETTING_DOWNLOAD_PATH, data.downloadPath])
     tb.add_row([LANG.SETTING_ONLY_M4A, data.onlyM4a])
     tb.add_row([LANG.SETTING_ADD_EXPLICIT_TAG, data.addExplicitTag])
     tb.add_row([LANG.SETTING_ADD_HYPHEN, data.addHyphen])
     tb.add_row([LANG.SETTING_ADD_YEAR, data.addYear])
     tb.add_row([LANG.SETTING_USE_TRACK_NUM, data.useTrackNumber])
     tb.add_row([LANG.SETTING_AUDIO_QUALITY, data.audioQuality])
     tb.add_row([LANG.SETTING_VIDEO_QUALITY, data.videoQuality])
     tb.add_row([LANG.SETTING_CHECK_EXIST, data.checkExist])
     tb.add_row([LANG.SETTING_ARTIST_BEFORE_TITLE, data.artistBeforeTitle])
     tb.add_row([LANG.SETTING_ALBUMID_BEFORE_FOLDER, data.addAlbumIDBeforeFolder])
     tb.add_row([LANG.SETTING_INCLUDE_EP, data.includeEP])
     tb.add_row([LANG.SETTING_SAVE_COVERS, data.saveCovers])
     tb.add_row([LANG.SETTING_LANGUAGE, getLangName(data.language)])
     print(tb)
コード例 #21
0
 def err(string):
     LANG = getLang()
     print(aigpy.cmd.red(LANG.PRINT_ERR + " ") + string)
     logging.error(string)
コード例 #22
0
 def err(string):
     LANG = getLang()
     print(red(LANG.PRINT_ERR + " ") + string)
コード例 #23
0
 def success(string):
     LANG = getLang()
     print(aigpy.cmd.green(LANG.PRINT_SUCCESS + " ") + string)
コード例 #24
0
 def info(string):
     LANG = getLang()
     print(aigpy.cmd.blue(LANG.PRINT_INFO + " ") + string)