From ea04cd58794ac3a9d81d55c495b6c0333a45f416 Mon Sep 17 00:00:00 2001 From: Broque Thomas <26755000+Nezreka@users.noreply.github.com> Date: Tue, 5 May 2026 11:22:01 -0700 Subject: [PATCH] Address Copilot review nits MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Three small follow-ups from the Copilot review of the rename PR: - services/sync_service.py: PlaylistSyncService.__init__'s download_orchestrator parameter was annotated as SoulseekClient, which was misleading (the object passed is the DownloadOrchestrator with .search_and_download_best, .download, etc — not a SoulseekClient). Switched the import + annotation to DownloadOrchestrator so type checking + IDE help match reality. - tests/test_qobuz_credential_sync.py: docstring still referenced the old soulseek_client global handle; updated to download_orchestrator to match the rest of the codebase. - core/downloads/monitor.py: the `for download in all_downloads` body was over-indented (8 spaces past the for instead of 4) — purely cosmetic but easy to mis-edit. Re-indented to one level. --- core/downloads/monitor.py | 24 ++++++++++++------------ services/sync_service.py | 4 ++-- tests/test_qobuz_credential_sync.py | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/core/downloads/monitor.py b/core/downloads/monitor.py index b28200e9..d08843a4 100644 --- a/core/downloads/monitor.py +++ b/core/downloads/monitor.py @@ -277,18 +277,18 @@ class WebUIDownloadMonitor: except Exception: pass for download in all_downloads: - key = _make_context_key(download.username, download.filename) - # Convert DownloadStatus to transfer dict format for monitor compatibility - live_transfers[key] = { - 'id': download.id, - 'filename': download.filename, - 'username': download.username, - 'state': download.state, - 'percentComplete': download.progress, - 'size': download.size, - 'bytesTransferred': download.transferred, - 'averageSpeed': download.speed, - } + key = _make_context_key(download.username, download.filename) + # Convert DownloadStatus to transfer dict format for monitor compatibility + live_transfers[key] = { + 'id': download.id, + 'filename': download.filename, + 'username': download.username, + 'state': download.state, + 'percentComplete': download.progress, + 'size': download.size, + 'bytesTransferred': download.transferred, + 'averageSpeed': download.speed, + } except Exception as yt_error: logger.error(f"Monitor: Could not fetch streaming source downloads: {yt_error}") diff --git a/services/sync_service.py b/services/sync_service.py index c4331a81..71a3cd35 100644 --- a/services/sync_service.py +++ b/services/sync_service.py @@ -7,7 +7,7 @@ from core.spotify_client import SpotifyClient, Playlist as SpotifyPlaylist, Trac from core.plex_client import PlexClient, PlexTrackInfo from core.jellyfin_client import JellyfinClient from core.navidrome_client import NavidromeClient -from core.soulseek_client import SoulseekClient +from core.download_orchestrator import DownloadOrchestrator from core.matching_engine import MusicMatchingEngine, MatchResult logger = get_logger("sync_service") @@ -44,7 +44,7 @@ class SyncProgress: failed_tracks: int = 0 class PlaylistSyncService: - def __init__(self, spotify_client: SpotifyClient, plex_client: PlexClient, download_orchestrator: SoulseekClient, jellyfin_client: JellyfinClient = None, navidrome_client = None): + def __init__(self, spotify_client: SpotifyClient, plex_client: PlexClient, download_orchestrator: DownloadOrchestrator, jellyfin_client: JellyfinClient = None, navidrome_client = None): self.spotify_client = spotify_client self.plex_client = plex_client self.jellyfin_client = jellyfin_client diff --git a/tests/test_qobuz_credential_sync.py b/tests/test_qobuz_credential_sync.py index 156db419..4432b28e 100644 --- a/tests/test_qobuz_credential_sync.py +++ b/tests/test_qobuz_credential_sync.py @@ -6,7 +6,7 @@ Settings showed "Connected: (Active)" but underneath an error yellow even after a successful login. Root cause: SoulSync runs two QobuzClient instances side by side — one -through ``soulseek_client.client('qobuz')`` for the auth-flow endpoints, and a +through ``download_orchestrator.client('qobuz')`` for the auth-flow endpoints, and a second owned by the enrichment worker thread for thread safety. Login only updated the first instance's in-memory state. The dashboard's "configured" check (and the connection-test step) read the worker