diff options
| author | Robert Honz <exislow+github@gmail.com> | 2024-11-29 17:41:25 +0100 |
|---|---|---|
| committer | Robert Honz <exislow+github@gmail.com> | 2024-11-29 17:41:25 +0100 |
| commit | 33a30537e9a205dd4b43e891b00c0b5f15a9b71b (patch) | |
| tree | 9ccb8c4c273ce96fd6ebce8ea2077d281d812712 /tidal_dl_ng/model | |
| parent | f2b3cc2505f4c64f09efacd775de3390ae204be0 (diff) | |
| parent | 4deaf94fb53ad304db73f9384f817b29afcac4a8 (diff) | |
| download | tidal-dl-ng-33a30537e9a205dd4b43e891b00c0b5f15a9b71b.tar.gz | |
✨ Merge with master.
Diffstat (limited to 'tidal_dl_ng/model')
| -rw-r--r-- | tidal_dl_ng/model/cfg.py | 18 | ||||
| -rw-r--r-- | tidal_dl_ng/model/downloader.py | 13 |
2 files changed, 23 insertions, 8 deletions
diff --git a/tidal_dl_ng/model/cfg.py b/tidal_dl_ng/model/cfg.py index fae3590..06614f4 100644 --- a/tidal_dl_ng/model/cfg.py +++ b/tidal_dl_ng/model/cfg.py @@ -3,13 +3,13 @@ from dataclasses import dataclass from dataclasses_json import dataclass_json from tidalapi import Quality -from tidal_dl_ng.constants import CoverDimensions, QualityVideo, SkipExisting +from tidal_dl_ng.constants import CoverDimensions, QualityVideo @dataclass_json @dataclass class Settings: - skip_existing: SkipExisting = SkipExisting.Disabled + skip_existing: bool = True lyrics_embed: bool = False lyrics_file: bool = False # TODO: Implement API KEY selection. @@ -25,7 +25,7 @@ class Settings: quality_video: QualityVideo = QualityVideo.P480 format_album: str = ( "Albums/{album_artist} - {album_title}{album_explicit}/{track_volume_num_optional}" - "{album_track_num}. {artist_name} - {track_title}" + "{album_track_num}. {artist_name} - {track_title}{album_explicit}" ) format_playlist: str = "Playlists/{playlist_name}/{artist_name} - {track_title}" format_mix: str = "Mix/{mix_name}/{artist_name} - {track_title}" @@ -37,16 +37,15 @@ class Settings: metadata_cover_embed: bool = True cover_album_file: bool = True extract_flac: bool = True + downloads_simultaneous_per_track_max: int = 20 + download_delay_sec_min: float = 3.0 + download_delay_sec_max: float = 5.0 @dataclass_json @dataclass class HelpSettings: - skip_existing: str = ( - "Do not download, if file already exists. Possible option false = do not skip, " - "'exact' = if filename already exists, 'extension_ignore' = skip even if a file with a " - "different file extension exists." - ) + skip_existing: str = "Skip download if file already exists." album_cover_save: str = "Safe cover to album folder." 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." @@ -82,6 +81,9 @@ class HelpSettings: metadata_cover_embed: str = "Embed album cover into file." cover_album_file: str = "Save cover to 'cover.jpg', if an album is downloaded." extract_flac: str = "Extract FLAC audio tracks from MP4 containers and save them as `*.flac` (uses FFmpeg)." + downloads_simultaneous_per_track_max: str = "Maximum number of simultaneous chunk downloads per track." + download_delay_sec_min: float = "Lower boundary for the calculation of the download delay in seconds." + download_delay_sec_max: float = "Upper boundary for the calculation of the download delay in seconds." @dataclass_json diff --git a/tidal_dl_ng/model/downloader.py b/tidal_dl_ng/model/downloader.py new file mode 100644 index 0000000..3f6151f --- /dev/null +++ b/tidal_dl_ng/model/downloader.py @@ -0,0 +1,13 @@ +import pathlib +from dataclasses import dataclass + +from requests import HTTPError + + +@dataclass +class DownloadSegmentResult: + result: bool + url: str + path_segment: pathlib.Path + id_segment: int + error: HTTPError | None = None |
