diff --git a/README.md b/README.md index f9ed48e7..ece21e23 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,41 @@ ![image-20200806013705425](https://i.loli.net/2020/08/06/sPLowIlCGyOdpVN.png) +## Settings - Possible Tags + +### Album + +| Tag | Example value | +| ----------------- | ----------------------------- | +| {ArtistName} | The Beatles | +| {AlbumArtistName} | The Beatles | +| {Flag} | | +| {AlbumID} | 55163243 | +| {AlbumYear} | 1963 | +| {AlbumTitle} | Please Please Me (Remastered) | +| {AudioQuality} | LOSSLESS | +| {DurationSeconds} | 1919 | +| {Duration} | 31:59 | +| {NumberOfTracks} | 14 | +| {NumberOfVideos} | 0 | +| {NumberOfVolumes} | 1 | +| {ReleaseDate} | 1963-03-22 | +| {RecordType} | ALBUM | + +### Track + +| Tag | Example Value | +| ----------------- | ------------------------------------------ | +| {TrackNumber} | 01 | +| {ArtistName} | The Beatles | +| {TrackTitle} | I Saw Her Standing There (Remastered 2009) | +| {ExplicitFlag} | | +| {AlbumYear} | 1963 | +| {AlbumTitle} | Please Please Me (Remastered) | +| {AudioQuality} | LOSSLESS | +| {DurationSeconds} | 173 | +| {Duration} | 02:53 | + ## ☕ Support If you really like my projects and want to support me, you can buy me a coffee and star this project. diff --git a/TIDALDL-PY/tidal_dl/download.py b/TIDALDL-PY/tidal_dl/download.py index fb3d071b..e226f59b 100644 --- a/TIDALDL-PY/tidal_dl/download.py +++ b/TIDALDL-PY/tidal_dl/download.py @@ -10,6 +10,7 @@ ''' import logging import os +import datetime import aigpy import lyricsgenius @@ -147,7 +148,6 @@ def __loadVideoAPI__(user): # result = __stripPathParts__(result, "\\") # return result.strip() - # "{ArtistName}/{Flag} [{AlbumID}] [{AlbumYear}] {AlbumTitle}" # def getAlbumPath(conf: Settings, album): # base = conf.downloadPath + '/Album/' @@ -324,6 +324,7 @@ def __loadVideoAPI__(user): # return True + def __downloadVideo__(conf, video: Video, album=None, playlist=None): if video.allowStreaming is False: Printf.err("Download failed! " + video.title + ' not allow streaming.') diff --git a/TIDALDL-PY/tidal_dl/lang/english.py b/TIDALDL-PY/tidal_dl/lang/english.py index 7f90cf2d..78883b56 100644 --- a/TIDALDL-PY/tidal_dl/lang/english.py +++ b/TIDALDL-PY/tidal_dl/lang/english.py @@ -2,9 +2,9 @@ # -*- encoding: utf-8 -*- ''' @File : english.py -@Time : 2020/08/19 -@Author : Yaronzz -@Version : 1.0 +@Time : 2021/11/11 +@Author : Yaronzz & jee019 +@Version : 1.1 @Contact : yaronhuang@foxmail.com @Desc : ''' @@ -24,7 +24,7 @@ class LangEnglish(object): SETTING_CHECK_EXIST = "Check exist" SETTING_ARTIST_BEFORE_TITLE = "ArtistName before track-title" SETTING_ALBUMID_BEFORE_FOLDER = "Id before album-folder" - SETTING_INCLUDE_EP = "Include single&ep" + SETTING_INCLUDE_EP = "Include singles & EPs" SETTING_SAVE_COVERS = "Save covers" SETTING_LANGUAGE = "Language" SETTING_USE_PLAYLIST_FOLDER = "Use playlist folder" @@ -36,7 +36,7 @@ class LangEnglish(object): SETTING_SAVE_ALBUMINFO = "Save AlbumInfo.txt" SETTING_ADD_LYRICS = "Add lyrics" SETTING_LYRICS_SERVER_PROXY = "Lyrics server proxy" - SETTINGS_ADD_LRC_FILE = "Save timed lyricss (.lrc file)" + SETTINGS_ADD_LRC_FILE = "Save timed lyrics (.lrc file)" SETTING_PATH = "Settings path" CHOICE = "CHOICE" @@ -81,7 +81,7 @@ class LangEnglish(object): CHANGE_SAVE_ALBUM_INFO = "Save AlbumInfo.txt('0'-No,'1'-Yes):" CHANGE_ADD_LYRICS = "Add lyrics('0'-No,'1'-Yes):" CHANGE_LYRICS_SERVER_PROXY = "Lyrics server proxy('0' not modify):" - CHANGE_ADD_LRC_FILE = "Save timed lyricss .lrc file ('0'-No,'1'-Yes):" + CHANGE_ADD_LRC_FILE = "Save timed lyrics .lrc file ('0'-No,'1'-Yes):" # {} are required in these strings AUTH_START_LOGIN = "Starting login process..." @@ -110,4 +110,4 @@ class LangEnglish(object): MODEL_ALBUM = 'Album' MODEL_ID = 'ID' MODEL_NAME = 'Name' - MODEL_TYPE = 'Type' + MODEL_TYPE = 'Type' \ No newline at end of file diff --git a/TIDALDL-PY/tidal_dl/lang/korean.py b/TIDALDL-PY/tidal_dl/lang/korean.py new file mode 100644 index 00000000..222ceb89 --- /dev/null +++ b/TIDALDL-PY/tidal_dl/lang/korean.py @@ -0,0 +1,113 @@ +#!/usr/bin/env python +# -*- encoding: utf-8 -*- +''' +@File : korean.py +@Time : 2021/11/11 +@Author : jee019 +@Version : 1.0 +@Contact : qwer010910@gmail.com +@Desc : +''' + + +class LangKorean(object): + SETTING = "설정" + VALUE = "값" + SETTING_DOWNLOAD_PATH = "다운로드 경로" + SETTING_ONLY_M4A = "mp4를 m4a로 변환" + SETTING_ADD_EXPLICIT_TAG = "explicit 태그 추가" + SETTING_ADD_HYPHEN = "하이픈 추가" + SETTING_ADD_YEAR = "앨범 폴더 앞에 연도 추가" + SETTING_USE_TRACK_NUM = "사용자 트랙 번호 추가" + SETTING_AUDIO_QUALITY = "음질" + SETTING_VIDEO_QUALITY = "영상 화질" + SETTING_CHECK_EXIST = "존재 유무 확인" + SETTING_ARTIST_BEFORE_TITLE = "트랙 제목 앞 아티스트 이름" + SETTING_ALBUMID_BEFORE_FOLDER = "앨범 폴더 앞 ID" + SETTING_INCLUDE_EP = "싱글 및 EP 포함" + SETTING_SAVE_COVERS = "커버 저장" + SETTING_LANGUAGE = "언어" + SETTING_USE_PLAYLIST_FOLDER = "재생목록 폴더 사용" + SETTING_MULITHREAD_DOWNLOAD = "다중 스레드 다운로드" + SETTING_ALBUM_FOLDER_FORMAT = "앨범 폴더 형식" + SETTING_TRACK_FILE_FORMAT = "트랙 파일 형식" + SETTING_SHOW_PROGRESS = "진행 상태 표시" + SETTING_SHOW_TRACKIFNO = "트랙 정보 표시" + SETTING_SAVE_ALBUMINFO = "AlbumInfo.txt 저장" + SETTING_ADD_LYRICS = "가사 추가" + SETTING_LYRICS_SERVER_PROXY = "가사 서버 프록시" + SETTINGS_ADD_LRC_FILE = "맞춤 가사 저장 (.lrc 파일)" + SETTING_PATH = "설정 경로" + + CHOICE = "선택" + FUNCTION = "기능" + CHOICE_ENTER = "엔터" + CHOICE_ENTER_URLID = "'Url/ID' 입력:" + CHOICE_EXIT = "종료" + CHOICE_LOGIN = "액세스 토큰 확인" + CHOICE_SETTINGS = "설정" + CHOICE_SET_ACCESS_TOKEN = "액세스 토큰 설정" + CHOICE_DOWNLOAD_BY_URL = "url 또는 id로 다운로드" + CHOICE_LOGOUT = "로그아웃" + + PRINT_ERR = "[에러]" + PRINT_INFO = "[정보]" + PRINT_SUCCESS = "[성공]" + + PRINT_ENTER_CHOICE = "선택 입력:" + PRINT_LATEST_VERSION = "최신 버전:" + # PRINT_USERNAME = "유저 이름:" + # PRINT_PASSWORD = "비밀번호:" + + CHANGE_START_SETTINGS = "설정 시작('0'-뒤로가기,'1'-예):" + CHANGE_DOWNLOAD_PATH = "다운로드 경로('0' 변경 안 함):" + CHANGE_AUDIO_QUALITY = "음질('0'-보통,'1'-높음,'2'-HiFi,'3'-Master):" + CHANGE_VIDEO_QUALITY = "영상 화질(1080, 720, 480, 360):" + CHANGE_ONLYM4A = "mp4를 m4a로 변환('0'-아니요,'1'-예):" + CHANGE_ADD_EXPLICIT_TAG = "파일 이름에 explicit 태그 추가('0'-아니요,'1'-예):" + CHANGE_ADD_HYPHEN = "파일 이름에 공백 대신 하이픈 사용('0'-아니요,'1'-예):" + CHANGE_ADD_YEAR = "앨범 폴더 이름에 연도 추가('0'-아니요,'1'-예):" + CHANGE_USE_TRACK_NUM = "파일 이름 앞에 트랙 번호 추가('0'-아니요,'1'-예):" + CHANGE_CHECK_EXIST = "다운로드 트랙 전에 존재하는 파일 확인('0'-아니요,'1'-예):" + CHANGE_ARTIST_BEFORE_TITLE = "트랙 제목 앞에 아티스트 이름 추가('0'-아니요,'1'-예):" + CHANGE_INCLUDE_EP = "아티스트 앨범 다운로드시 싱글 및 EP 포함('0'-아니요,'1'-예):" + CHANGE_ALBUMID_BEFORE_FOLDER = "앨범 폴더 앞에 ID 추가('0'-아니요,'1'-예):" + CHANGE_SAVE_COVERS = "커버 저장('0'-아니요,'1'-예):" + CHANGE_LANGUAGE = "언어 선택" + CHANGE_ALBUM_FOLDER_FORMAT = "앨범 폴더 형식('0' 변경 안 함,'default' 기본 설정):" + CHANGE_TRACK_FILE_FORMAT = "트랙 파일 형식('0' 변경 안 함,'default' 기본 설정):" + CHANGE_SHOW_PROGRESS = "진행 상태 표시('0'-아니요,'1'-예):" + CHANGE_SHOW_TRACKINFO = "트랙 정보 표시('0'-아니요,'1'-예):" + CHANGE_SAVE_ALBUM_INFO = "AlbumInfo.txt 저장('0'-아니요,'1'-예):" + CHANGE_ADD_LYRICS = "가사 추가('0'-아니요,'1'-예):" + CHANGE_LYRICS_SERVER_PROXY = "가사 서버 프록시('0' 변경 안 함):" + CHANGE_ADD_LRC_FILE = "맞춤 가사 .lrc 파일 저장 ('0'-아니요,'1'-예):" + + # {} are required in these strings + AUTH_START_LOGIN = "로그인 중..." + AUTH_LOGIN_CODE = "로그인 코드는 다음과 같습니다. {}" + AUTH_NEXT_STEP = "설치를 완료하려면 {}로 이동하십시오. 다음 {} 내에 있습니다." + AUTH_WAITING = "승인 대기 중..." + AUTH_TIMEOUT = "작업 시간 초과" + + MSG_VALID_ACCESSTOKEN = "{}에 대해 액세스토큰이 유효합니다." + MSG_INVAILD_ACCESSTOKEN = "만료된 액세스 토큰입니다. 새로 고침 중입니다." + MSG_PATH_ERR = "경로 오류!" + MSG_INPUT_ERR = "입력 오류!" + + MODEL_ALBUM_PROPERTY = "앨범-정보" + MODEL_TRACK_PROPERTY = "트랙-정보" + MODEL_VIDEO_PROPERTY = "영상-정보" + MODEL_ARTIST_PROPERTY = "아티스트-정보" + MODEL_PLAYLIST_PROPERTY = "재생목록-정보" + + MODEL_TITLE = '제목' + MODEL_TRACK_NUMBER = '트랙 넘버' + MODEL_VIDEO_NUMBER = '영상 넘버' + MODEL_RELEASE_DATE = '발매일' + MODEL_VERSION = '버전' + MODEL_EXPLICIT = 'Explicit' + MODEL_ALBUM = '앨범' + MODEL_ID = '아이디' + MODEL_NAME = '이름' + MODEL_TYPE = '형식' diff --git a/TIDALDL-PY/tidal_dl/lang/language.py b/TIDALDL-PY/tidal_dl/lang/language.py index dbe312ed..f8efdc15 100644 --- a/TIDALDL-PY/tidal_dl/lang/language.py +++ b/TIDALDL-PY/tidal_dl/lang/language.py @@ -26,6 +26,7 @@ from tidal_dl.lang.turkish import LangTurkish from tidal_dl.lang.ukrainian import LangUkrainian from tidal_dl.lang.vietnamese import LangVietnamese +from tidal_dl.lang.korean import LangKorean LANG = None @@ -71,6 +72,8 @@ def setLang(index): LANG = LangDanish() elif str(index) == '16': LANG = LangHungarian() + elif str(index) == '17': + LANG = LangKorean() else: LANG = LangEnglish() return LANG @@ -116,6 +119,8 @@ def getLangName(index): return "Danish" if str(index) == '16': return "Hungarian" + if str(index) == '17': + return "Korean" return "" diff --git a/TIDALDL-PY/tidal_dl/lang/vietnamese.py b/TIDALDL-PY/tidal_dl/lang/vietnamese.py index e320ede3..12c2fc5a 100644 --- a/TIDALDL-PY/tidal_dl/lang/vietnamese.py +++ b/TIDALDL-PY/tidal_dl/lang/vietnamese.py @@ -14,7 +14,7 @@ class LangVietnamese(object): SETTING = "THIẾT LẬP" VALUE = "GIÁ TRỊ" SETTING_DOWNLOAD_PATH = "Đường dẫn tải về" - SETTING_ONLY_M4A = "Đổi mp4 qua m4a" + SETTING_ONLY_M4A = "Đổi mp4 sang m4a" SETTING_ADD_EXPLICIT_TAG = "Thêm tag explicit" SETTING_ADD_HYPHEN = "Thêm dấu nối" SETTING_ADD_YEAR = "Thêm năm trước thư mục album" @@ -36,8 +36,8 @@ class LangVietnamese(object): SETTING_SAVE_ALBUMINFO = "Lưu AlbumInfo.txt" SETTING_ADD_LYRICS = "Thêm lời bài hát" SETTING_LYRICS_SERVER_PROXY = "Máy chủ proxy cho lyrics" - SETTING_PATH = "Settings path" - SETTINGS_ADD_LRC_FILE = "Save timed lyrics (.lrc file)" + SETTINGS_ADD_LRC_FILE = "Lưu timed lyrics (tệp .lrc)" + SETTING_PATH = "Đường dẫn cài đặt" CHOICE = "LỰA CHỌN" FUNCTION = "CHỨC NĂNG" @@ -63,9 +63,9 @@ class LangVietnamese(object): CHANGE_DOWNLOAD_PATH = "Đường dẫn tải về('0' không đổi):" CHANGE_AUDIO_QUALITY = "Chất lượng âm thanh('0'-Normal,'1'-High,'2'-HiFi,'3'-Master):" CHANGE_VIDEO_QUALITY = "Chất lượng video(1080, 720, 480, 360):" - CHANGE_ONLYM4A = "Đổi mp4 qua m4a('0'-Không,'1'-Có):" + CHANGE_ONLYM4A = "Đổi mp4 sang m4a('0'-Không,'1'-Có):" CHANGE_ADD_EXPLICIT_TAG = "Thêm tag explicit vào tên tệp('0'-Không,'1'-Có):" - CHANGE_ADD_HYPHEN = "Dùng gạch nối thay vì spaces trong tên tệp('0'-Không,'1'-Có):" + CHANGE_ADD_HYPHEN = "Dùng gạch nối thay vì dấu cách trong tên tệp('0'-Không,'1'-Có):" CHANGE_ADD_YEAR = "Thêm năm phía trước tên thư mục album('0'-Không,'1'-Có):" CHANGE_USE_TRACK_NUM = "Thêm số thứ tự bài ở đầu tên tệp('0'-Không,'1'-Có):" CHANGE_CHECK_EXIST = "Kiểm tra tệp đã tồn tại chưa trước khi tải('0'-Không,'1'-Có):" @@ -77,11 +77,11 @@ class LangVietnamese(object): CHANGE_ALBUM_FOLDER_FORMAT = "Định dạng thư mục album('0' không đổi,'default' để đặt về mặc định):" CHANGE_TRACK_FILE_FORMAT = "Định dạng tên tệp nhạc('0' không đổi,'default' để đặt về mặc định):" CHANGE_SHOW_PROGRESS = "Hiện tiến trình('0'-Không,'1'-Có):" - CHANGE_SHOW_TRACKINFO = "Show track info('0'-No,'1'-Yes):" + CHANGE_SHOW_TRACKINFO = "Hiện thông tin bài('0'-No,'1'-Yes):" CHANGE_SAVE_ALBUM_INFO = "Lưu AlbumInfo.txt('0'-Không,'1'-Có):" CHANGE_ADD_LYRICS = "Thêm lời bài hát('0'-Không,'1'-Có):" CHANGE_LYRICS_SERVER_PROXY = "Máy chủ proxy cho lyrics('0' không đổi):" - CHANGE_ADD_LRC_FILE = "Save timed lyrics .lrc file ('0'-No,'1'-Yes):" + CHANGE_ADD_LRC_FILE = "Lưu timed lyrics tệp .lrc ('0'-No,'1'-Yes):" # {} are required in these strings AUTH_START_LOGIN = "Đang bắt đầu đăng nhập..." diff --git a/TIDALDL-PY/tidal_dl/printf.py b/TIDALDL-PY/tidal_dl/printf.py index c171b0a3..5f6a4047 100644 --- a/TIDALDL-PY/tidal_dl/printf.py +++ b/TIDALDL-PY/tidal_dl/printf.py @@ -28,7 +28,7 @@ https://github.com/yaronzz/Tidal-Media-Downloader ''' -VERSION = '2021.9.23.1' +VERSION = '2021.11.15.1' class Printf(object): diff --git a/TIDALDL-PY/tidal_dl/util.py b/TIDALDL-PY/tidal_dl/util.py index 8218733d..5091f98c 100644 --- a/TIDALDL-PY/tidal_dl/util.py +++ b/TIDALDL-PY/tidal_dl/util.py @@ -42,6 +42,12 @@ def __getExtension__(url): return '.m4a' +def __secondsToTimeStr__(seconds): + time_string = str(datetime.timedelta(seconds=seconds)) + if time_string.startswith('0:'): + time_string = time_string[2:] + return time_string + def __parseContributors__(roleType, Contributors): if Contributors is None: return None @@ -96,6 +102,7 @@ def getArtistsName(artists): def getAlbumPath(conf: Settings, album): base = conf.downloadPath + '/Album/' artist = aigpy.path.replaceLimitChar(getArtistsName(album.artists), '-') + albumArtistName = album.artist.name if album.artist is not None else "None" # album folder pre: [ME][ID] flag = API.getFlag(album, Type.Album, True, "") if conf.audioQuality != AudioQuality.Master: @@ -116,10 +123,19 @@ def getAlbumPath(conf: Settings, album): if retpath is None or len(retpath) <= 0: retpath = Settings.getDefaultAlbumFolderFormat() retpath = retpath.replace(R"{ArtistName}", artist.strip()) + retpath = retpath.replace(R"{AlbumArtistName}", albumArtistName.strip()) retpath = retpath.replace(R"{Flag}", flag) retpath = retpath.replace(R"{AlbumID}", sid) retpath = retpath.replace(R"{AlbumYear}", year) retpath = retpath.replace(R"{AlbumTitle}", albumname.strip()) + retpath = retpath.replace(R"{AudioQuality}", album.audioQuality) + retpath = retpath.replace(R"{DurationSeconds}", str(album.duration)) + retpath = retpath.replace(R"{Duration}", __secondsToTimeStr__(album.duration)) + retpath = retpath.replace(R"{NumberOfTracks}", str(album.numberOfTracks)) + retpath = retpath.replace(R"{NumberOfVideos}", str(album.numberOfVideos)) + retpath = retpath.replace(R"{NumberOfVolumes}", str(album.numberOfVolumes)) + retpath = retpath.replace(R"{ReleaseDate}", album.releaseDate) + retpath = retpath.replace(R"{RecordType}", album.type) retpath = stripPath(retpath.strip()) return base + retpath @@ -169,6 +185,9 @@ def getTrackPath(conf: Settings, track, stream, album=None, playlist=None): retpath = retpath.replace(R"{ExplicitFlag}", explicit) retpath = retpath.replace(R"{AlbumYear}", year) retpath = retpath.replace(R"{AlbumTitle}", albumname.strip()) + retpath = retpath.replace(R"{AudioQuality}", track.audioQuality) + retpath = retpath.replace(R"{DurationSeconds}", str(track.duration)) + retpath = retpath.replace(R"{Duration}", __secondsToTimeStr__(track.duration)) retpath = retpath.strip() return base + retpath + extension