mirror of
https://github.com/CDrummond/bliss-analyser.git
synced 2026-10-22 14:32:08 +03:00
Add option to remove failures
This commit is contained in:
1 parent
0202c68579
commit
50c564cde0
3 files changed
+47
-4
No files matched your search
@@ -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<PathBuf>, 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);
|
||||
|
||||
+4
-2
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user