fix(library): extract track/disc number from file tags during backfill import
insert_qobuz_cached_track_direct was hardcoding track_number to 0, causing all imported tracks to show wrong numbers. Now accepts track_number and disc_number params, and both callers (backfill downloads and offline cache sync) extract metadata from the audio file via MetadataExtractor before inserting. Also fix LocalLibraryView to use || instead of ?? for track_number fallback, so 0 correctly falls back to index-based numbering. Closes #147
This commit is contained in:
4 files changed
+30
-5
No files matched your search
@@ -3348,6 +3348,8 @@ impl LibraryDatabase {
|
||||
file_path: &str,
|
||||
bit_depth: Option<u32>,
|
||||
sample_rate: Option<f64>,
|
||||
track_number: Option<u32>,
|
||||
disc_number: Option<u32>,
|
||||
) -> Result<(), LibraryError> {
|
||||
use std::time::SystemTime;
|
||||
|
||||
@@ -3378,8 +3380,8 @@ impl LibraryDatabase {
|
||||
artist,
|
||||
album.unwrap_or("Unknown Album"),
|
||||
artist, // Use artist as album_artist for proper grouping
|
||||
0, // track_number - will be updated if metadata is available
|
||||
None::<u32>, // disc_number
|
||||
track_number.map(|v| v as i64),
|
||||
disc_number.map(|v| v as i64),
|
||||
None::<u32>, // year
|
||||
duration_secs as i64,
|
||||
"flac", // Default format for downloads
|
||||
|
||||
Reference in new issue
Block a user