diff options
| author | Winman486 <harpsystems@gmail.com> | 2025-10-21 15:23:18 -0500 |
|---|---|---|
| committer | Winman486 <harpsystems@gmail.com> | 2025-10-21 15:23:18 -0500 |
| commit | e9070eef66622ac80c9e7a68b00aa268e669e8fa (patch) | |
| tree | 8366d7f88b411fc583ef06427a10584c1ef93af6 /tidal_dl_ng/model | |
| parent | 6c1704e3c466e043acf6afcb7929b27d131df92f (diff) | |
| download | tidal-dl-ng-e9070eef66622ac80c9e7a68b00aa268e669e8fa.tar.gz | |
refactor: Make rate limiting configurable and move session validation to Tidal class
- Add api_rate_limit_batch_size and api_rate_limit_delay_sec to Settings (cfg.py)
- Move validate_session() and is_authentication_error() to Tidal class (config.py)
- Update _load_albums_with_rate_limiting() to use config values instead of hardcoded 20/3
- Update _handle_album_load_error() to use Tidal.is_authentication_error()
- Remove _validate_session() from gui.py (now uses Tidal.validate_session())
- Addresses maintainer feedback: configurable tweaking variables and proper separation of concerns
Diffstat (limited to 'tidal_dl_ng/model')
| -rw-r--r-- | tidal_dl_ng/model/cfg.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/tidal_dl_ng/model/cfg.py b/tidal_dl_ng/model/cfg.py index 1c87992..4101b9d 100644 --- a/tidal_dl_ng/model/cfg.py +++ b/tidal_dl_ng/model/cfg.py @@ -59,6 +59,9 @@ class Settings: filename_delimiter_artist: str = ", " filename_delimiter_album_artist: str = ", " metadata_target_upc: MetadataTargetUPC = MetadataTargetUPC.UPC + # Rate limiting for API calls (tweaking variables) + api_rate_limit_batch_size: int = 20 # Number of albums to process before applying rate limit delay + api_rate_limit_delay_sec: float = 3.0 # Delay in seconds between batches to avoid rate limiting @dataclass_json @@ -127,6 +130,8 @@ class HelpSettings: metadata_target_upc: str = ( "Select the target metadata tag ('UPC', 'BARCODE', 'EAN') where to write the UPC information to. Default: 'UPC'." ) + api_rate_limit_batch_size: str = "Number of albums to process before applying rate limit delay (tweaking variable)." + api_rate_limit_delay_sec: str = "Delay in seconds between batches to avoid API rate limiting (tweaking variable)." @dataclass_json |
