mirror of
https://github.com/CDrummond/bliss-analyser.git
synced 2025-04-08 05:00:02 +03:00
Number cue tracks from 1, should match LMS track number
This commit is contained in:
parent
5fef00c24a
commit
25c01f4434
@ -57,8 +57,7 @@ fn get_file_list(db:&mut db::Db, mpath:&PathBuf, path:&PathBuf, track_paths:&mut
|
||||
if cue_file.exists() {
|
||||
// Found a CUE file, try to parse and then check if tracks exists in DB
|
||||
let this_cue_tracks = cue::parse(&pb, &cue_file);
|
||||
let mut analyse = false;
|
||||
for track in this_cue_tracks.iter() {
|
||||
for track in this_cue_tracks {
|
||||
match track.track_path.strip_prefix(mpath) {
|
||||
Ok(tstripped) => {
|
||||
let spb = tstripped.to_path_buf();
|
||||
@ -66,7 +65,7 @@ fn get_file_list(db:&mut db::Db, mpath:&PathBuf, path:&PathBuf, track_paths:&mut
|
||||
match db.get_rowid(&sname) {
|
||||
Ok(id) => {
|
||||
if id<=0 {
|
||||
analyse = true;
|
||||
cue_tracks.push(track.clone());
|
||||
}
|
||||
},
|
||||
Err(_) => { }
|
||||
@ -75,12 +74,6 @@ fn get_file_list(db:&mut db::Db, mpath:&PathBuf, path:&PathBuf, track_paths:&mut
|
||||
Err(_) => { }
|
||||
}
|
||||
}
|
||||
|
||||
if analyse {
|
||||
for track in this_cue_tracks {
|
||||
cue_tracks.push(track);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let spb = stripped.to_path_buf();
|
||||
let sname = String::from(spb.to_string_lossy());
|
||||
|
@ -26,8 +26,7 @@ pub struct CueTrack {
|
||||
pub album_artist:String,
|
||||
pub genre:String,
|
||||
pub start:Duration,
|
||||
pub duration:Duration,
|
||||
pub analyse:bool
|
||||
pub duration:Duration
|
||||
}
|
||||
|
||||
pub fn parse(audio_path:&PathBuf, cue_path:&PathBuf) -> Vec<CueTrack> {
|
||||
@ -50,7 +49,7 @@ pub fn parse(audio_path:&PathBuf, cue_path:&PathBuf) -> Vec<CueTrack> {
|
||||
Some((_, start)) => {
|
||||
let mut track_path = audio_path.clone();
|
||||
let ext = audio_path.extension().unwrap().to_string_lossy();
|
||||
track_path.set_extension(format!("{}{}{}.mp3", ext, MARKER, resp.len()));
|
||||
track_path.set_extension(format!("{}{}{}.mp3", ext, MARKER, resp.len()+1));
|
||||
let ctrack = CueTrack {
|
||||
audio_path: audio_path.clone(),
|
||||
track_path: track_path,
|
||||
@ -61,7 +60,6 @@ pub fn parse(audio_path:&PathBuf, cue_path:&PathBuf) -> Vec<CueTrack> {
|
||||
genre: genre.clone(),
|
||||
start: start.clone(),
|
||||
duration: Duration::new(LAST_TRACK_DURATION, 0),
|
||||
analyse: false
|
||||
};
|
||||
resp.push(ctrack);
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user