2023-12-19 23:58:57 +01:00
|
|
|
from dataclasses import dataclass
|
|
|
|
|
|
|
|
|
|
from dataclasses_json import dataclass_json
|
|
|
|
|
from tidalapi import Quality
|
|
|
|
|
|
2024-11-13 09:09:00 +01:00
|
|
|
from tidal_dl_ng.constants import CoverDimensions, QualityVideo
|
2024-01-12 08:15:54 +01:00
|
|
|
|
2023-12-19 23:58:57 +01:00
|
|
|
|
|
|
|
|
@dataclass_json
|
|
|
|
|
@dataclass
|
|
|
|
|
class Settings:
|
2024-11-13 09:09:00 +01:00
|
|
|
skip_existing: bool = True
|
2024-02-01 20:10:14 +01:00
|
|
|
lyrics_embed: bool = False
|
|
|
|
|
lyrics_file: bool = False
|
2023-12-19 23:58:57 +01:00
|
|
|
# TODO: Implement API KEY selection.
|
2024-01-14 23:09:43 +01:00
|
|
|
# api_key_index: bool = 0
|
2024-01-14 18:10:58 +01:00
|
|
|
# TODO: Implement album info download to separate file.
|
2024-01-14 23:09:43 +01:00
|
|
|
# album_info_save: bool = False
|
2023-12-19 23:58:57 +01:00
|
|
|
video_download: bool = True
|
2024-01-14 18:10:58 +01:00
|
|
|
# TODO: Implement multi threading for downloads.
|
2024-01-14 23:09:43 +01:00
|
|
|
# multi_thread: bool = False
|
2023-12-19 23:58:57 +01:00
|
|
|
download_delay: bool = True
|
2024-02-04 12:17:57 +01:00
|
|
|
download_base_path: str = "~/download"
|
2023-12-19 23:58:57 +01:00
|
|
|
quality_audio: Quality = Quality.low_320k
|
|
|
|
|
quality_video: QualityVideo = QualityVideo.P480
|
2024-04-20 11:38:21 +02:00
|
|
|
format_album: str = (
|
2024-11-10 14:21:10 +01:00
|
|
|
"Albums/{album_artist} - {album_title}{album_explicit}/{track_volume_num_optional}"
|
2024-11-17 23:04:50 +01:00
|
|
|
"{album_track_num}. {artist_name} - {track_title}{album_explicit}"
|
2024-04-20 11:38:21 +02:00
|
|
|
)
|
2025-04-02 07:00:28 +02:00
|
|
|
format_playlist: str = "Playlists/{playlist_name}/{list_pos}. {artist_name} - {track_title}"
|
2024-11-17 23:04:50 +01:00
|
|
|
format_mix: str = "Mix/{mix_name}/{artist_name} - {track_title}"
|
2024-04-20 11:38:21 +02:00
|
|
|
format_track: str = "Tracks/{artist_name} - {track_title}{track_explicit}"
|
|
|
|
|
format_video: str = "Videos/{artist_name} - {track_title}{track_explicit}"
|
2023-12-19 23:58:57 +01:00
|
|
|
video_convert_mp4: bool = True
|
2024-03-29 10:54:04 +01:00
|
|
|
path_binary_ffmpeg: str = ""
|
2024-01-14 17:29:39 +01:00
|
|
|
metadata_cover_dimension: CoverDimensions = CoverDimensions.Px320
|
2024-11-11 10:05:32 +01:00
|
|
|
metadata_cover_embed: bool = True
|
|
|
|
|
cover_album_file: bool = True
|
2024-04-21 19:18:05 +02:00
|
|
|
extract_flac: bool = True
|
2024-11-12 22:15:11 +01:00
|
|
|
downloads_simultaneous_per_track_max: int = 20
|
2024-11-20 12:28:18 +01:00
|
|
|
download_delay_sec_min: float = 3.0
|
|
|
|
|
download_delay_sec_max: float = 5.0
|
2024-12-15 23:35:10 +01:00
|
|
|
album_track_num_pad_min: int = 1
|
|
|
|
|
downloads_concurrent_max: int = 3
|
2024-12-16 08:14:39 +01:00
|
|
|
symlink_to_track: bool = False
|
|
|
|
|
playlist_create: bool = False
|
2025-10-06 12:37:12 +02:00
|
|
|
metadata_replay_gain: bool = False
|
2025-08-12 19:36:41 +02:00
|
|
|
metadata_write_url: bool = True
|
2025-09-01 14:49:24 -04:00
|
|
|
window_x: int = 50
|
|
|
|
|
window_y: int = 50
|
|
|
|
|
window_w: int = 1200
|
|
|
|
|
window_h: int = 800
|
2023-12-19 23:58:57 +01:00
|
|
|
|
|
|
|
|
|
2024-02-06 17:23:37 +01:00
|
|
|
@dataclass_json
|
2023-12-19 23:58:57 +01:00
|
|
|
@dataclass
|
|
|
|
|
class HelpSettings:
|
2024-11-13 09:09:00 +01:00
|
|
|
skip_existing: str = "Skip download if file already exists."
|
2023-12-19 23:58:57 +01:00
|
|
|
album_cover_save: str = "Safe cover to album folder."
|
2024-02-12 06:05:13 +01:00
|
|
|
lyrics_embed: str = "Embed lyrics in audio file, if lyrics are available."
|
|
|
|
|
lyrics_file: str = "Save lyrics to separate *.lrc file, if lyrics are available."
|
2023-12-19 23:58:57 +01:00
|
|
|
api_key_index: str = "Set the device API KEY."
|
|
|
|
|
album_info_save: str = "Save album info to track?"
|
|
|
|
|
video_download: str = "Allow download of videos."
|
|
|
|
|
multi_thread: str = "Download several tracks in parallel."
|
|
|
|
|
download_delay: str = "Activate randomized download delay to mimic human behaviour."
|
|
|
|
|
download_base_path: str = "Where to store the downloaded media."
|
|
|
|
|
quality_audio: str = (
|
|
|
|
|
'Desired audio download quality: "LOW" (96kbps), "HIGH" (320kbps), '
|
|
|
|
|
'"LOSSLESS" (16 Bit, 44,1 kHz), '
|
2024-11-06 15:01:18 +01:00
|
|
|
'"HI_RES_LOSSLESS" (up to 24 Bit, 192 kHz)'
|
2023-12-19 23:58:57 +01:00
|
|
|
)
|
|
|
|
|
quality_video: str = 'Desired video download quality: "360", "480", "720", "1080"'
|
|
|
|
|
# TODO: Describe possible variables.
|
|
|
|
|
format_album: str = "Where to download albums and how to name the items."
|
|
|
|
|
format_playlist: str = "Where to download playlists and how to name the items."
|
|
|
|
|
format_mix: str = "Where to download mixes and how to name the items."
|
|
|
|
|
format_track: str = "Where to download tracks and how to name the items."
|
|
|
|
|
format_video: str = "Where to download videos and how to name the items."
|
|
|
|
|
video_convert_mp4: str = (
|
|
|
|
|
"Videos are downloaded as MPEG Transport Stream (TS) files. With this option each video "
|
2024-07-02 16:26:15 -07:00
|
|
|
"will be converted to MP4. FFmpeg must be installed."
|
2023-12-19 23:58:57 +01:00
|
|
|
)
|
2024-11-06 09:41:39 +01:00
|
|
|
path_binary_ffmpeg: str = (
|
|
|
|
|
"Path to FFmpeg binary file (executable). Only necessary if FFmpeg not set in $PATH. Mandatory for Windows: "
|
|
|
|
|
"The directory of `ffmpeg.exe`must be set in %PATH%."
|
|
|
|
|
)
|
2024-01-14 17:29:39 +01:00
|
|
|
metadata_cover_dimension: str = (
|
|
|
|
|
"The dimensions of the cover image embedded into the track. Possible values: 320x320, 640x640x 1280x1280."
|
|
|
|
|
)
|
2024-11-11 10:05:32 +01:00
|
|
|
metadata_cover_embed: str = "Embed album cover into file."
|
|
|
|
|
cover_album_file: str = "Save cover to 'cover.jpg', if an album is downloaded."
|
2024-04-21 19:18:05 +02:00
|
|
|
extract_flac: str = "Extract FLAC audio tracks from MP4 containers and save them as `*.flac` (uses FFmpeg)."
|
2024-11-12 22:15:11 +01:00
|
|
|
downloads_simultaneous_per_track_max: str = "Maximum number of simultaneous chunk downloads per track."
|
2024-12-15 20:37:06 +01:00
|
|
|
download_delay_sec_min: str = "Lower boundary for the calculation of the download delay in seconds."
|
|
|
|
|
download_delay_sec_max: str = "Upper boundary for the calculation of the download delay in seconds."
|
|
|
|
|
album_track_num_pad_min: str = (
|
2024-12-15 23:35:10 +01:00
|
|
|
"Minimum length of the album track count, will be padded with zeroes (0). To disable padding set this to 1."
|
2024-12-15 20:37:06 +01:00
|
|
|
)
|
2024-12-15 23:35:10 +01:00
|
|
|
downloads_concurrent_max: str = "Maximum concurrent number of downloads (threads)."
|
2024-12-16 08:14:39 +01:00
|
|
|
symlink_to_track: str = (
|
|
|
|
|
"If enabled the tracks of albums, playlists and mixes will be downloaded to the track directory but symlinked "
|
|
|
|
|
"accordingly."
|
|
|
|
|
)
|
|
|
|
|
playlist_create: str = "Creates a '_playlist.m3u8' file for downloaded albums, playlists and mixes."
|
2025-02-28 10:55:41 +01:00
|
|
|
metadata_replay_gain: str = "Replay gain information will be written to metadata."
|
2025-08-12 19:36:41 +02:00
|
|
|
metadata_write_url: str = "URL of the media file will be written to metadata."
|
2025-09-08 09:49:21 -04:00
|
|
|
window_x: str = "X-Coordinate of saved window location."
|
|
|
|
|
window_y: str = "Y-Coordinate of saved window location."
|
|
|
|
|
window_w: str = "Width of saved window size."
|
|
|
|
|
window_h: str = "Height of saved window size."
|
2023-12-19 23:58:57 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
@dataclass_json
|
|
|
|
|
@dataclass
|
|
|
|
|
class Token:
|
|
|
|
|
token_type: str | None = None
|
|
|
|
|
access_token: str | None = None
|
|
|
|
|
refresh_token: str | None = None
|
|
|
|
|
expiry_time: float = 0.0
|