diff --git a/UserGuide.md b/UserGuide.md index 831fc33..67ed075 100644 --- a/UserGuide.md +++ b/UserGuide.md @@ -118,7 +118,10 @@ any changes. * `ignore` Reads the `ignore` file and updates the database to flag tracks as to be ignored for mixes. * `export` Exports tags from database and stores within the audio files. - +* `clearfail` If analysis fails for a track then the track path and its modification +time is stored in the database, so that running analysis again ignores these files. +This action clears this information, so that an analysis run will attempt to analyse +these files. Analysing tracks @@ -146,6 +149,10 @@ is shown. As a rough guide, a 2015-era i7 8-core laptop with SSD analyses around 14000 tracks/hour. +If analysis fails for a track, then the track's path and timestamp are stored +within the database so that subsquent analysis calls will skip these tracks. + + Tags ---- When analysing tracks, the analyser will first check for a `BLISS_ANALYSIS` tag @@ -304,7 +311,7 @@ is accomplished as follows: Exporting Analysis ================== -If you have analysis results stored within the SQLite database, and not within +If you have analysis results stored within the database, and not within the files themselves, then you can use the `export` action to copy these analysis results from the database and into the files. @@ -322,6 +329,29 @@ analysis results from the database and into the files. +Clearing Failed Tracks +====================== + +Any tracks that could not be analysed are stored in the database so that +subsequent analysis runs ignore such files - unless the files themselves +have been updated. + +You can remove this list of failed tracks, from database, via the +following command: + + +(Linux / macOS) +``` +./bliss-analyser clearfail +``` + +(Windows) +``` +.\bliss-analyser.exe clearfail +``` + + + Credits ======= diff --git a/src/db.rs b/src/db.rs index f03e500..1acefce 100644 --- a/src/db.rs +++ b/src/db.rs @@ -239,6 +239,10 @@ impl Db { self.remove_old_from_table(mpaths, dry_run, "Failures"); } + fn clear_failures(&self) { + let _ = self.conn.execute("DELETE FROM Failures;", []); + } + pub fn get_failure_timestamp(&self, path: &String) -> i64 { let mut ts:i64 = 0; let mut db_path = path.to_string(); @@ -553,6 +557,13 @@ pub fn export(db_path: &str, mpaths: &Vec, max_threads: usize, preserve db.close(); } +pub fn clear_failures(db_path: &str) { + let db = Db::new(&String::from(db_path)); + db.init(); + db.clear_failures(); + db.close(); +} + pub fn update_ignore(db_path: &str, ignore_path: &PathBuf) { let file = File::open(ignore_path).unwrap(); let reader = BufReader::new(file); diff --git a/src/main.rs b/src/main.rs index 68e2a2a..9b94fc1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -91,7 +91,7 @@ fn main() { arg_parse.refer(&mut read_tags).add_option(&["-R", "--readtags"], StoreTrue, "When analysing files, attempt to read results from tags"); arg_parse.refer(&mut preserve_mod_times).add_option(&["-p", "--preserve"], StoreTrue, "Preserve modification time when writing results to files"); arg_parse.refer(&mut send_notifs).add_option(&["-N", "--notifs"], StoreTrue, "Periodically send notification messages to LMS"); - arg_parse.refer(&mut task).add_argument("task", Store, "Task to perform; analyse, tags, ignore, upload, export, stopmixer."); + arg_parse.refer(&mut task).add_argument("task", Store, "Task to perform; analyse, tags, ignore, upload, export, clearfail, stopmixer."); arg_parse.parse_args_or_exit(); } @@ -110,7 +110,7 @@ fn main() { builder.init(); if task.is_empty() { - log::error!("No task specified, please choose from; analyse, tags, ignore, upload, export, stopmixer"); + log::error!("No task specified, please choose from; analyse, tags, ignore, upload, export, clearfail, stopmixer"); process::exit(-1); } @@ -244,6 +244,8 @@ fn main() { db::update_ignore(&db_path, &ignore_path); } else if task.eq_ignore_ascii_case("export") { db::export(&db_path, &music_paths, max_threads, preserve_mod_times); + } else if task.eq_ignore_ascii_case("clearfail") { + db::clear_failures(&db_path); } else { let ignore_path = PathBuf::from(&ignore_file); let modified = analyse::analyse_files(&db_path, &music_paths, dry_run, keep_old, max_num_files, max_threads,