From a5da6e475532530371e3049180bf2d62e007f4f8 Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Mon, 23 Feb 2026 02:15:35 -0600 Subject: [PATCH 01/25] feat(ui): add ImageLightbox component --- src/lib/components/ImageLightbox.svelte | 118 ++++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 src/lib/components/ImageLightbox.svelte diff --git a/src/lib/components/ImageLightbox.svelte b/src/lib/components/ImageLightbox.svelte new file mode 100644 index 000000000..a9c66cf14 --- /dev/null +++ b/src/lib/components/ImageLightbox.svelte @@ -0,0 +1,118 @@ + + + + +{#if isOpen} + +{/if} + + From b8f8ca4e3d22f6ddf97da6f2ad5039959ea678fa Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Mon, 23 Feb 2026 02:16:45 -0600 Subject: [PATCH 02/25] feat(ui): click artist image to view full size --- .../components/views/ArtistDetailView.svelte | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/lib/components/views/ArtistDetailView.svelte b/src/lib/components/views/ArtistDetailView.svelte index 95d2f1f78..a1374fc98 100644 --- a/src/lib/components/views/ArtistDetailView.svelte +++ b/src/lib/components/views/ArtistDetailView.svelte @@ -25,6 +25,7 @@ toggleTrackFavorite } from '$lib/stores/favoritesStore'; import { tick, onMount, onDestroy } from 'svelte'; + import ImageLightbox from '../ImageLightbox.svelte'; interface Track { id: number; @@ -135,6 +136,7 @@ let bioExpanded = $state(false); let imageError = $state(false); + let lightboxOpen = $state(false); let topTracks = $state([]); let tracksLoading = $state(false); let isFavorite = $state(false); @@ -1298,7 +1300,13 @@
-
+
{ if (!imageError && artist.image) lightboxOpen = true; }} + onkeydown={(e) => { if (e.key === 'Enter' && !imageError && artist.image) lightboxOpen = true; }} + role="button" + tabindex="0" + > {#if imageError || !artist.image}
@@ -2437,6 +2445,14 @@ {/if}
+ lightboxOpen = false} + src={artist.image ?? ''} + alt={artist.name} + round={true} +/> + diff --git a/src/lib/i18n/locales/de.json b/src/lib/i18n/locales/de.json index 7d4fae301..aacfcd2d3 100644 --- a/src/lib/i18n/locales/de.json +++ b/src/lib/i18n/locales/de.json @@ -241,7 +241,13 @@ "noBiography": "Keine Biografie verfügbar", "tributes": "Tributes & Coverversionen", "others": "Andere", - "playlists": "Playlists" + "playlists": "Playlists", + "addImage": "Eigenes Künstlerbild hinzufügen", + "changeImage": "Eigenes Künstlerbild ändern", + "removeImage": "Eigenes Künstlerbild entfernen", + "customImageSet": "Künstlerbild aktualisiert", + "customImageRemoved": "Eigenes Künstlerbild entfernt", + "customImageError": "Fehler beim Aktualisieren des Künstlerbilds" }, "sort": { "nameAZ": "Name (A-Z)", diff --git a/src/lib/i18n/locales/en.json b/src/lib/i18n/locales/en.json index aff4b7cec..2891cdb34 100644 --- a/src/lib/i18n/locales/en.json +++ b/src/lib/i18n/locales/en.json @@ -253,7 +253,13 @@ "noBiography": "No biography available", "tributes": "Tributes & Covers", "others": "Others", - "playlists": "Playlists" + "playlists": "Playlists", + "addImage": "Add custom artist image", + "changeImage": "Change custom artist image", + "removeImage": "Remove custom artist image", + "customImageSet": "Artist image updated", + "customImageRemoved": "Custom artist image removed", + "customImageError": "Failed to update artist image" }, "sort": { "nameAZ": "Name (A-Z)", diff --git a/src/lib/i18n/locales/es.json b/src/lib/i18n/locales/es.json index 00338fbe3..965645c43 100644 --- a/src/lib/i18n/locales/es.json +++ b/src/lib/i18n/locales/es.json @@ -253,7 +253,13 @@ "noBiography": "No hay biografía disponible", "tributes": "Tributos y Covers", "others": "Otros", - "playlists": "Playlists" + "playlists": "Playlists", + "addImage": "Agregar imagen personalizada", + "changeImage": "Cambiar imagen personalizada", + "removeImage": "Eliminar imagen personalizada", + "customImageSet": "Imagen del artista actualizada", + "customImageRemoved": "Imagen personalizada eliminada", + "customImageError": "Error al actualizar imagen del artista" }, "sort": { "nameAZ": "Nombre (A-Z)", diff --git a/src/lib/i18n/locales/fr.json b/src/lib/i18n/locales/fr.json index 07574216f..02eeac646 100644 --- a/src/lib/i18n/locales/fr.json +++ b/src/lib/i18n/locales/fr.json @@ -241,7 +241,13 @@ "noBiography": "Aucune biographie disponible", "tributes": "Hommages et reprises", "others": "Autres", - "playlists": "Playlists" + "playlists": "Playlists", + "addImage": "Ajouter une image personnalisée", + "changeImage": "Changer l'image personnalisée", + "removeImage": "Supprimer l'image personnalisée", + "customImageSet": "Image de l'artiste mise à jour", + "customImageRemoved": "Image personnalisée supprimée", + "customImageError": "Erreur lors de la mise à jour de l'image" }, "sort": { "nameAZ": "Nom (A-Z)", From 26d8fb502cba125c54b576f1c510acb46e511cab Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Mon, 23 Feb 2026 02:42:03 -0600 Subject: [PATCH 08/25] feat(backend): add bulk fetch for custom artist images Add get_all_custom_artist_images() database method and v2_library_get_all_custom_artist_images command to support loading all custom artist image overrides at once for the global resolution store. --- crates/qbz-library/src/database.rs | 28 ++++++++++++++++++++++++++++ src-tauri/src/commands_v2.rs | 9 +++++++++ src-tauri/src/lib.rs | 1 + 3 files changed, 38 insertions(+) diff --git a/crates/qbz-library/src/database.rs b/crates/qbz-library/src/database.rs index 52d05f33a..903b93876 100644 --- a/crates/qbz-library/src/database.rs +++ b/crates/qbz-library/src/database.rs @@ -3457,6 +3457,34 @@ impl LibraryDatabase { Ok(result) } + /// Get all custom artist images (for bulk lookup) + pub fn get_all_custom_artist_images( + &self, + ) -> Result, LibraryError> { + let mut stmt = self + .conn + .prepare( + "SELECT artist_name, custom_image_path FROM artist_images WHERE custom_image_path IS NOT NULL", + ) + .map_err(|e| LibraryError::Database(format!("Failed to prepare query: {}", e)))?; + + let rows = stmt + .query_map([], |row| { + Ok((row.get::<_, String>(0)?, row.get::<_, String>(1)?)) + }) + .map_err(|e| { + LibraryError::Database(format!("Failed to query custom artist images: {}", e)) + })?; + + let mut map = std::collections::HashMap::new(); + for row in rows { + if let Ok((artist_name, custom_image_path)) = row { + map.insert(artist_name, custom_image_path); + } + } + Ok(map) + } + /// Get all canonical artist names mapping (for bulk lookup) pub fn get_all_canonical_names( &self, diff --git a/src-tauri/src/commands_v2.rs b/src-tauri/src/commands_v2.rs index 56328a424..28f451c37 100644 --- a/src-tauri/src/commands_v2.rs +++ b/src-tauri/src/commands_v2.rs @@ -4337,6 +4337,15 @@ pub async fn v2_library_get_artist_image( db.get_artist_image(&artist_name).map_err(|e| e.to_string()) } +#[tauri::command] +pub async fn v2_library_get_all_custom_artist_images( + state: State<'_, LibraryState>, +) -> Result, String> { + let guard = state.db.lock().await; + let db = guard.as_ref().ok_or("No active session - please log in")?; + db.get_all_custom_artist_images().map_err(|e| e.to_string()) +} + #[tauri::command] pub async fn v2_create_artist_radio( artist_id: u64, diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index 10832c50f..fb131dd02 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -904,6 +904,7 @@ pub fn run() { commands_v2::v2_library_set_custom_artist_image, commands_v2::v2_library_remove_custom_artist_image, commands_v2::v2_library_get_artist_image, + commands_v2::v2_library_get_all_custom_artist_images, commands_v2::v2_show_track_notification, commands_v2::v2_subscribe_playlist, commands_v2::v2_cache_track_for_offline, From 076c2482dc9c9909cee83d91f2fe86b9009de2b5 Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Mon, 23 Feb 2026 02:42:34 -0600 Subject: [PATCH 09/25] feat(store): create customArtistImageStore Centralized store for resolving custom artist image overrides globally. Loaded on login, exposes resolveArtistImage() with normalized name matching (handles diacritics, case differences). --- src/lib/stores/customArtistImageStore.ts | 118 +++++++++++++++++++++++ 1 file changed, 118 insertions(+) create mode 100644 src/lib/stores/customArtistImageStore.ts diff --git a/src/lib/stores/customArtistImageStore.ts b/src/lib/stores/customArtistImageStore.ts new file mode 100644 index 000000000..8d6bdcc03 --- /dev/null +++ b/src/lib/stores/customArtistImageStore.ts @@ -0,0 +1,118 @@ +/** + * Custom Artist Image Store + * + * Manages global resolution of user-uploaded custom artist images. + * Loaded on login, exposes resolveArtistImage() for all views. + */ + +import { invoke, convertFileSrc } from '@tauri-apps/api/core'; + +// ============ State ============ + +/** Map of normalized artist name -> asset URL (convertFileSrc'd) */ +let imageMap: Map = new Map(); + +/** Map of normalized name -> original name (for reverse lookup) */ +let nameMap: Map = new Map(); + +const listeners = new Set<() => void>(); + +function notifyListeners(): void { + for (const listener of listeners) { + listener(); + } +} + +// ============ Normalization ============ + +/** + * Normalize artist name for matching. + * Lowercase, strip diacritics, strip non-alphanumeric. + * Handles "Björk" vs "Bjork", "Héctor Lavoe" vs "Hector Lavoe", etc. + */ +function normalize(name: string): string { + return name + .normalize('NFD') + .replace(/[\u0300-\u036f]/g, '') + .toLowerCase() + .replace(/[^a-z0-9]/g, ''); +} + +// ============ Public API ============ + +/** + * Load all custom artist images from backend + */ +export async function initCustomArtistImageStore(): Promise { + const mapping = await invoke>( + 'v2_library_get_all_custom_artist_images' + ); + + imageMap = new Map(); + nameMap = new Map(); + + for (const [artistName, filePath] of Object.entries(mapping)) { + const key = normalize(artistName); + imageMap.set(key, convertFileSrc(filePath)); + nameMap.set(key, artistName); + } + + notifyListeners(); +} + +/** + * Resolve artist image: returns custom URL if set, otherwise the default. + */ +export function resolveArtistImage( + artistName: string, + defaultUrl: string +): string { + const key = normalize(artistName); + return imageMap.get(key) ?? defaultUrl; +} + +/** + * Check if an artist has a custom image override. + */ +export function hasCustomImage(artistName: string): boolean { + return imageMap.has(normalize(artistName)); +} + +/** + * Update store after user sets a custom image (no backend call). + */ +export function setCustomImage(artistName: string, assetUrl: string): void { + const key = normalize(artistName); + imageMap.set(key, assetUrl); + nameMap.set(key, artistName); + notifyListeners(); +} + +/** + * Update store after user removes a custom image (no backend call). + */ +export function removeCustomImage(artistName: string): void { + const key = normalize(artistName); + imageMap.delete(key); + nameMap.delete(key); + notifyListeners(); +} + +/** + * Clear all custom artist images (on logout). + */ +export function clearCustomArtistImages(): void { + imageMap = new Map(); + nameMap = new Map(); + notifyListeners(); +} + +/** + * Subscribe to store changes. + */ +export function subscribe(listener: () => void): () => void { + listeners.add(listener); + return () => { + listeners.delete(listener); + }; +} From fce342a3e915732ed8c65947d45989f60e098ad0 Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Mon, 23 Feb 2026 02:43:24 -0600 Subject: [PATCH 10/25] feat(app): initialize custom artist image store on login Load all custom artist image overrides on login and clear them on logout, alongside existing blacklist store init. --- src/routes/+page.svelte | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index a813e67d8..1acf60067 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -50,6 +50,7 @@ isAutoplayEnabled } from '$lib/stores/playbackPreferencesStore'; import { initBlacklistStore, isBlacklisted as isArtistBlacklisted } from '$lib/stores/artistBlacklistStore'; + import { initCustomArtistImageStore, clearCustomArtistImages } from '$lib/stores/customArtistImageStore'; // UI state management import { @@ -2583,6 +2584,7 @@ console.log('[Session] Persist session enabled:', sessionPersistEnabled); }).catch(err => console.debug('[PlaybackPrefs] Init deferred:', err)); initBlacklistStore().catch(err => console.debug('[Blacklist] Init deferred:', err)); + initCustomArtistImageStore().catch(err => console.debug('[CustomArtistImages] Init deferred:', err)); refreshUpdatePreferences().catch(err => console.debug('[Updates] Prefs refresh deferred:', err)); // Load audio settings (normalization state) now that session is active @@ -2701,6 +2703,7 @@ setStorageUserId(null); // Clear session state await clearSession(); + clearCustomArtistImages(); setLoggedOut(); sessionReady = false; updatesLaunchTriggered = false; From 75b46a207797cf8941ca14e2e00d580f79d95f4c Mon Sep 17 00:00:00 2001 From: vicrodh <103399283+vicrodh@users.noreply.github.com> Date: Mon, 23 Feb 2026 02:44:16 -0600 Subject: [PATCH 11/25] feat(ui): resolve custom artist images in SearchView Wrap getArtistImage() to check custom image store before falling back to Qobuz default. All 3 call sites (most popular, search results, virtual grid) get the override automatically. --- src/lib/components/views/SearchView.svelte | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/components/views/SearchView.svelte b/src/lib/components/views/SearchView.svelte index 28a5c6daa..f4effe00d 100644 --- a/src/lib/components/views/SearchView.svelte +++ b/src/lib/components/views/SearchView.svelte @@ -1,6 +1,7 @@