Skip to content

Commit

Permalink
Fix checking if CUE already analysed.
Browse files Browse the repository at this point in the history
Issue #2
  • Loading branch information
CDrummond committed May 28, 2022
1 parent df17032 commit fa87a7e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
0.2.1
-----
1. Update version of tag reader library.
2. Fix checking if CUE already analysed.

0.2.0
-----
Expand Down
17 changes: 11 additions & 6 deletions src/analyse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,19 @@ fn check_dir_entry(db: &mut db::Db, mpath: &Path, entry: DirEntry, track_paths:
cue_file.set_extension("cue");
if cue_file.exists() {
// 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();
track_path.set_extension(format!("{}{}1", ext, db::CUE_MARKER));
let db_track = String::from(track_path.to_string_lossy());
if let Ok(id) = db.get_rowid(&db_track) {
if id<=0 {
track_paths.push(String::from(cue_file.to_string_lossy()));
cue_track_path.set_extension(format!("{}{}1", ext, db::CUE_MARKER));
match cue_track_path.strip_prefix(mpath) {
Ok(cue_track_stripped) => {
let cue_track_sname = String::from(cue_track_stripped.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 {
if let Ok(id) = db.get_rowid(&sname) {
Expand Down

0 comments on commit fa87a7e

Please sign in to comment.