Fix checking if CUE already analysed.

Issue #2
This commit is contained in:
CDrummond committed 2022-05-28 17:24:09 +01:00
1 parent df17032377
commit fa87a7e135
3 files changed
+13 -7

No files matched your search

Generated
+1 -1
View File
@@ -113,7 +113,7 @@ dependencies = [
[[package]] [[package]]
name = "bliss-analyser" name = "bliss-analyser"
version = "0.2.0" version = "0.2.1"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"argparse", "argparse",
+1
View File
@@ -1,6 +1,7 @@
0.2.1 0.2.1
----- -----
1. Update version of tag reader library. 1. Update version of tag reader library.
2. Fix checking if CUE already analysed.
0.2.0 0.2.0
----- -----
+11 -6
View File
@@ -58,14 +58,19 @@ fn check_dir_entry(db: &mut db::Db, mpath: &Path, entry: DirEntry, track_paths:
cue_file.set_extension("cue"); cue_file.set_extension("cue");
if cue_file.exists() { if cue_file.exists() {
// For cue files, check if first track is in DB // For cue files, check if first track is in DB
let mut track_path = pb.clone(); let mut cue_track_path = pb.clone();
let ext = pb.extension().unwrap().to_string_lossy(); let ext = pb.extension().unwrap().to_string_lossy();
track_path.set_extension(format!("{}{}1", ext, db::CUE_MARKER)); cue_track_path.set_extension(format!("{}{}1", ext, db::CUE_MARKER));
let db_track = String::from(track_path.to_string_lossy()); match cue_track_path.strip_prefix(mpath) {
if let Ok(id) = db.get_rowid(&db_track) { Ok(cue_track_stripped) => {
if id<=0 { let cue_track_sname = String::from(cue_track_stripped.to_string_lossy());
track_paths.push(String::from(cue_file.to_string_lossy())); if let Ok(id) = db.get_rowid(&cue_track_sname) {
if id<=0 {
track_paths.push(String::from(cue_file.to_string_lossy()));
}
}
} }
Err(_) => { }
} }
} else { } else {
if let Ok(id) = db.get_rowid(&sname) { if let Ok(id) = db.get_rowid(&sname) {