From db785a1bfa0542790e24d0b37b680a477a82877e Mon Sep 17 00:00:00 2001 From: Xoconoch Date: Wed, 13 Aug 2025 21:18:54 -0600 Subject: [PATCH] Update backend for "spotify_metadata" deezspot option --- routes/system/config.py | 1 + routes/utils/album.py | 2 ++ routes/utils/celery_config.py | 2 ++ routes/utils/celery_tasks.py | 12 ++++++++++++ routes/utils/playlist.py | 2 ++ routes/utils/track.py | 2 ++ 6 files changed, 21 insertions(+) diff --git a/routes/system/config.py b/routes/system/config.py index 21524eb..ecf7f0c 100644 --- a/routes/system/config.py +++ b/routes/system/config.py @@ -168,6 +168,7 @@ def _migrate_legacy_keys_inplace(cfg: dict) -> bool: "retry_delay_increase": "retryDelayIncrease", "artist_separator": "artistSeparator", "recursive_quality": "recursiveQuality", + "spotify_metadata": "spotifyMetadata", } modified = False for legacy, camel in legacy_map.items(): diff --git a/routes/utils/album.py b/routes/utils/album.py index 077eaea..23c7c06 100755 --- a/routes/utils/album.py +++ b/routes/utils/album.py @@ -29,6 +29,7 @@ def download_album( bitrate=None, artist_separator="; ", recursive_quality=True, + spotify_metadata=True, _is_celery_task_execution=False, # Added to skip duplicate check from Celery task ): if not _is_celery_task_execution: @@ -114,6 +115,7 @@ def download_album( convert_to=convert_to, bitrate=bitrate, artist_separator=artist_separator, + spotify_metadata=spotify_metadata, ) print( f"DEBUG: album.py - Album download via Deezer (account: {fallback}) successful for Spotify URL." diff --git a/routes/utils/celery_config.py b/routes/utils/celery_config.py index bd47a4d..6e06bcd 100644 --- a/routes/utils/celery_config.py +++ b/routes/utils/celery_config.py @@ -46,6 +46,7 @@ DEFAULT_MAIN_CONFIG = { "bitrate": None, "artistSeparator": "; ", "recursiveQuality": False, + "spotifyMetadata": True, "watch": {}, } @@ -60,6 +61,7 @@ def _migrate_legacy_keys(cfg: dict) -> tuple[dict, bool]: "retry_delay_increase": "retryDelayIncrease", "artist_separator": "artistSeparator", "recursive_quality": "recursiveQuality", + "spotify_metadata": "spotifyMetadata", } for legacy, camel in legacy_map.items(): if legacy in out and camel not in out: diff --git a/routes/utils/celery_tasks.py b/routes/utils/celery_tasks.py index 07a3ed2..654d8a7 100644 --- a/routes/utils/celery_tasks.py +++ b/routes/utils/celery_tasks.py @@ -1623,6 +1623,9 @@ def download_track(self, **task_data): artist_separator = task_data.get( "artist_separator", config_params.get("artistSeparator", "; ") ) + spotify_metadata = task_data.get( + "spotify_metadata", config_params.get("spotifyMetadata", True) + ) # Execute the download - service is now determined from URL download_track_func( @@ -1641,6 +1644,7 @@ def download_track(self, **task_data): bitrate=bitrate, recursive_quality=recursive_quality, artist_separator=artist_separator, + spotify_metadata=spotify_metadata, _is_celery_task_execution=True, # Skip duplicate check inside Celery task (consistency) ) @@ -1718,6 +1722,9 @@ def download_album(self, **task_data): artist_separator = task_data.get( "artist_separator", config_params.get("artistSeparator", "; ") ) + spotify_metadata = task_data.get( + "spotify_metadata", config_params.get("spotifyMetadata", True) + ) # Execute the download - service is now determined from URL download_album_func( @@ -1736,6 +1743,7 @@ def download_album(self, **task_data): bitrate=bitrate, recursive_quality=recursive_quality, artist_separator=artist_separator, + spotify_metadata=spotify_metadata, _is_celery_task_execution=True, # Skip duplicate check inside Celery task ) @@ -1813,6 +1821,9 @@ def download_playlist(self, **task_data): artist_separator = task_data.get( "artist_separator", config_params.get("artistSeparator", "; ") ) + spotify_metadata = task_data.get( + "spotify_metadata", config_params.get("spotifyMetadata", True) + ) # Get retry parameters initial_retry_delay = task_data.get( @@ -1843,6 +1854,7 @@ def download_playlist(self, **task_data): bitrate=bitrate, recursive_quality=recursive_quality, artist_separator=artist_separator, + spotify_metadata=spotify_metadata, _is_celery_task_execution=True, # Skip duplicate check inside Celery task ) diff --git a/routes/utils/playlist.py b/routes/utils/playlist.py index e268467..d6105b3 100755 --- a/routes/utils/playlist.py +++ b/routes/utils/playlist.py @@ -26,6 +26,7 @@ def download_playlist( bitrate=None, artist_separator="; ", recursive_quality=True, + spotify_metadata=True, _is_celery_task_execution=False, # Added to skip duplicate check from Celery task ): if not _is_celery_task_execution: @@ -111,6 +112,7 @@ def download_playlist( convert_to=convert_to, bitrate=bitrate, artist_separator=artist_separator, + spotify_metadata=spotify_metadata, ) print( f"DEBUG: playlist.py - Playlist download via Deezer (account: {fallback}) successful for Spotify URL." diff --git a/routes/utils/track.py b/routes/utils/track.py index 25a60aa..61d86af 100755 --- a/routes/utils/track.py +++ b/routes/utils/track.py @@ -27,6 +27,7 @@ def download_track( bitrate=None, artist_separator="; ", recursive_quality=False, + spotify_metadata=True, _is_celery_task_execution=False, # Added for consistency, not currently used for duplicate check ): try: @@ -105,6 +106,7 @@ def download_track( convert_to=convert_to, bitrate=bitrate, artist_separator=artist_separator, + spotify_metadata=spotify_metadata, ) print( f"DEBUG: track.py - Track download via Deezer (account: {fallback}) successful for Spotify URL."