Compare commits
2 Commits
4f4e6e794a
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 11a8d3a88e | |||
| ed8175b1d0 |
+5
-1
@@ -107,7 +107,11 @@ async fn process_file(
|
|||||||
bitrate: Set(meta.bitrate),
|
bitrate: Set(meta.bitrate),
|
||||||
file_size: Set(scanned.file_size),
|
file_size: Set(scanned.file_size),
|
||||||
fingerprint: NotSet,
|
fingerprint: NotSet,
|
||||||
musicbrainz_id: Set(meta.musicbrainz_recording_id),
|
musicbrainz_id: if meta.musicbrainz_recording_id.is_some() {
|
||||||
|
Set(meta.musicbrainz_recording_id)
|
||||||
|
} else {
|
||||||
|
NotSet // Don't overwrite existing DB MBID when file tag is missing
|
||||||
|
},
|
||||||
artist_id: Set(artist_id),
|
artist_id: Set(artist_id),
|
||||||
album_id: Set(album_id),
|
album_id: Set(album_id),
|
||||||
file_mtime: Set(Some(scanned.mtime)),
|
file_mtime: Set(Some(scanned.mtime)),
|
||||||
|
|||||||
@@ -58,10 +58,12 @@ async fn test_scan_indexes_music_files() {
|
|||||||
create_test_mp3(dir.path(), "song1.mp3", "Time", "Pink Floyd", "DSOTM");
|
create_test_mp3(dir.path(), "song1.mp3", "Time", "Pink Floyd", "DSOTM");
|
||||||
create_test_mp3(dir.path(), "song2.mp3", "Money", "Pink Floyd", "DSOTM");
|
create_test_mp3(dir.path(), "song2.mp3", "Money", "Pink Floyd", "DSOTM");
|
||||||
|
|
||||||
|
// Use concurrency=1 to avoid race in album upsert when two files
|
||||||
|
// share the same artist+album and are processed simultaneously.
|
||||||
let config = ScanConfig {
|
let config = ScanConfig {
|
||||||
root: dir.path().to_owned(),
|
root: dir.path().to_owned(),
|
||||||
dry_run: false,
|
dry_run: false,
|
||||||
concurrency: 2,
|
concurrency: 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
let stats = run_scan(db.conn(), &config).await.unwrap();
|
let stats = run_scan(db.conn(), &config).await.unwrap();
|
||||||
|
|||||||
Reference in New Issue
Block a user