def changeSettings(): global LANG Printf.settings(CONF) choice = Printf.enter(LANG.CHANGE_START_SETTINGS) if choice == '0': return CONF.downloadPath = Printf.enterPath(LANG.CHANGE_DOWNLOAD_PATH, LANG.MSG_PATH_ERR, '0', CONF.downloadPath) CONF.audioQuality = AudioQuality(int(Printf.enterLimit( LANG.CHANGE_AUDIO_QUALITY, LANG.MSG_INPUT_ERR, ['0', '1', '2', '3']))) CONF.videoQuality = VideoQuality(int(Printf.enterLimit( LANG.CHANGE_VIDEO_QUALITY, LANG.MSG_INPUT_ERR, ['1080', '720', '480', '360']))) CONF.onlyM4a = Printf.enter(LANG.CHANGE_ONLYM4A) == '1' CONF.checkExist = Printf.enter(LANG.CHANGE_CHECK_EXIST) == '1' CONF.includeEP = Printf.enter(LANG.CHANGE_INCLUDE_EP) == '1' CONF.saveCovers = Printf.enter(LANG.CHANGE_SAVE_COVERS) == '1' CONF.showProgress = Printf.enter(LANG.CHANGE_SHOW_PROGRESS) == '1' CONF.saveAlbumInfo = Printf.enter(LANG.CHANGE_SAVE_ALBUM_INFO) == '1' CONF.showTrackInfo = Printf.enter(LANG.CHANGE_SHOW_TRACKINFO) == '1' CONF.usePlaylistFolder = Printf.enter(LANG.SETTING_USE_PLAYLIST_FOLDER + "('0'-No,'1'-Yes):") == '1' CONF.language = Printf.enter(LANG.CHANGE_LANGUAGE + "(" + getLangChoicePrint() + "):") CONF.albumFolderFormat = Printf.enterFormat( LANG.CHANGE_ALBUM_FOLDER_FORMAT, CONF.albumFolderFormat, Settings.getDefaultAlbumFolderFormat()) CONF.trackFileFormat = Printf.enterFormat(LANG.CHANGE_TRACK_FILE_FORMAT, CONF.trackFileFormat, Settings.getDefaultTrackFileFormat()) CONF.videoFileFormat = Printf.enterFormat(LANG.CHANGE_VIDEO_FILE_FORMAT, CONF.videoFileFormat, Settings.getDefaultVideoFileFormat()) CONF.addLyrics = Printf.enter(LANG.CHANGE_ADD_LYRICS) == '1' CONF.lyricsServerProxy = Printf.enterFormat( LANG.CHANGE_LYRICS_SERVER_PROXY, CONF.lyricsServerProxy, CONF.lyricsServerProxy) CONF.lyricFile = Printf.enter(LANG.CHANGE_ADD_LRC_FILE) == '1' CONF.addTypeFolder = Printf.enter(LANG.CHANGE_ADD_TYPE_FOLDER) == '1' LANG = setLang(CONF.language) Settings.save(CONF)
def getVideoPath(conf, video, album=None, playlist=None): if album is not None and album.title is not None: base = getAlbumPath(conf, album) elif playlist is not None and conf.usePlaylistFolder: base = getPlaylistPath(conf, playlist) else: base = conf.downloadPath + '/' if conf.addTypeFolder: base = base + 'Video/' # get number number = __getIndexStr__(video.trackNumber) # get artist artists = aigpy.path.replaceLimitChar(getArtistsName(video.artists), '-') artist = aigpy.path.replaceLimitChar( video.artist.name, '-') if video.artist is not None else "" # get explicit explicit = "(Explicit)" if conf.addExplicitTag and video.explicit else '' # title title = aigpy.path.replaceLimitChar(video.title, '-') # year year = "" if video.releaseDate is not None: year = aigpy.string.getSubOnlyEnd(video.releaseDate, '-') # extension extension = ".mp4" retpath = conf.videoFileFormat # R"{VideoNumber} - {ArtistName} - [{ArtistsName}] - {VideoYear} - {VideoID} - {VideoTitle}{ExplicitFlag}" if retpath is None or len(retpath) <= 0: retpath = Settings.getDefaultVideoFileFormat() retpath = retpath.replace(R"{VideoNumber}", number) retpath = retpath.replace(R"{ArtistName}", artist.strip()) retpath = retpath.replace(R"{ArtistsName}", artists.strip()) retpath = retpath.replace(R"{VideoTitle}", title) retpath = retpath.replace(R"{ExplicitFlag}", explicit) retpath = retpath.replace(R"{VideoYear}", year) retpath = retpath.replace(R"{VideoID}", str(video.id)) retpath = retpath.strip() return base + retpath + extension