feat(library): add source badge to album cards in Local Library
Albums now show a small badge indicating their source: - HardDrive icon for local files (source='user') - Qobuz logo for offline cached content (source='qobuz_download') Badge appears in bottom-right corner of album artwork.
This commit is contained in:
1 parent
e025882a9f
commit
e8f0c96ccc
7 files changed
+820
-6
No files matched your search
@@ -1039,7 +1039,8 @@ impl LibraryDatabase {
|
||||
MAX(format) as format,
|
||||
MAX(bit_depth) as bit_depth,
|
||||
MAX(sample_rate) as sample_rate,
|
||||
MAX(group_key) as directory_path
|
||||
MAX(group_key) as directory_path,
|
||||
MAX(source) as source
|
||||
FROM (
|
||||
SELECT
|
||||
COALESCE(album_group_key, album || '|' || COALESCE(album_artist, artist)) as group_key,
|
||||
@@ -1051,7 +1052,8 @@ impl LibraryDatabase {
|
||||
duration_secs,
|
||||
format,
|
||||
bit_depth,
|
||||
sample_rate
|
||||
sample_rate,
|
||||
COALESCE(source, 'user') as source
|
||||
FROM local_tracks
|
||||
WHERE 1=1 {} {}
|
||||
)
|
||||
@@ -1078,7 +1080,8 @@ impl LibraryDatabase {
|
||||
MAX(format) as format,
|
||||
MAX(bit_depth) as bit_depth,
|
||||
MAX(sample_rate) as sample_rate,
|
||||
MAX(group_key) as directory_path
|
||||
MAX(group_key) as directory_path,
|
||||
MAX(source) as source
|
||||
FROM (
|
||||
SELECT
|
||||
COALESCE(album_group_key, album || '|' || COALESCE(album_artist, artist)) as group_key,
|
||||
@@ -1090,7 +1093,8 @@ impl LibraryDatabase {
|
||||
duration_secs,
|
||||
format,
|
||||
bit_depth,
|
||||
sample_rate
|
||||
sample_rate,
|
||||
COALESCE(source, 'user') as source
|
||||
FROM local_tracks
|
||||
WHERE 1=1 {} {}
|
||||
)
|
||||
@@ -1135,6 +1139,7 @@ impl LibraryDatabase {
|
||||
directory_path: row
|
||||
.get::<_, Option<String>>(11)?
|
||||
.unwrap_or_else(|| group_key.clone()),
|
||||
source: row.get::<_, Option<String>>(12)?.unwrap_or_else(|| "user".to_string()),
|
||||
})
|
||||
})
|
||||
.map_err(|e| LibraryError::Database(e.to_string()))?;
|
||||
|
||||
@@ -136,6 +136,13 @@ pub struct LocalAlbum {
|
||||
pub bit_depth: Option<u32>,
|
||||
pub sample_rate: f64, // Changed from u32 to f64 for decimal precision
|
||||
pub directory_path: String,
|
||||
/// Source of the album: "user" for local files, "qobuz_download" for offline cached
|
||||
#[serde(default = "default_source")]
|
||||
pub source: String,
|
||||
}
|
||||
|
||||
fn default_source() -> String {
|
||||
"user".to_string()
|
||||
}
|
||||
|
||||
/// An artist aggregated from local tracks
|
||||
|
||||
Reference in new issue
Block a user