feat(library): extract and display album artwork
- Extract embedded artwork from audio files during scan - Save extracted artwork to cache directory (~/.cache/qbz/artwork) - Fallback to folder artwork (cover.jpg, folder.jpg, front.jpg, etc.) - Add get_artwork_cache_dir helper function - Artwork now displays in album cards and detail views
This commit is contained in:
1 parent
e8a61a45ce
commit
f6dbf2ee2a
3 files changed
+45
-2
No files matched your search
@@ -197,6 +197,31 @@ impl MetadataExtractor {
|
||||
}
|
||||
hash
|
||||
}
|
||||
|
||||
/// Look for folder artwork (cover.jpg, folder.jpg, etc.)
|
||||
/// Returns the path if found
|
||||
pub fn find_folder_artwork(audio_file_path: &Path) -> Option<String> {
|
||||
let parent_dir = audio_file_path.parent()?;
|
||||
|
||||
// Common artwork filenames in order of preference
|
||||
const ARTWORK_NAMES: &[&str] = &[
|
||||
"cover.jpg", "cover.jpeg", "cover.png",
|
||||
"folder.jpg", "folder.jpeg", "folder.png",
|
||||
"front.jpg", "front.jpeg", "front.png",
|
||||
"album.jpg", "album.jpeg", "album.png",
|
||||
"Cover.jpg", "Cover.jpeg", "Cover.png",
|
||||
"Folder.jpg", "Folder.jpeg", "Folder.png",
|
||||
];
|
||||
|
||||
for name in ARTWORK_NAMES {
|
||||
let artwork_path = parent_dir.join(name);
|
||||
if artwork_path.exists() {
|
||||
return Some(artwork_path.to_string_lossy().to_string());
|
||||
}
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in new issue
Block a user