If fail to remove old tracks from DB, then output more info.

This commit is contained in:
Craig Drummond 2022-03-07 19:49:05 +00:00
parent a35140c10e
commit 7996d9a525
2 changed files with 9 additions and 1 deletions

View File

@ -4,6 +4,7 @@
2. Update user docs.
3. Update ignore syntax to allow adding SQL WHERE clauses.
4. Use newer version of tag reader library.
5. If fail to remove old tracks from DB, then output more info.
0.0.1
-----

View File

@ -169,12 +169,19 @@ impl Db {
}
log::info!("Num non-existant tracks: {}", to_remove.len());
if !dry_run {
let count_before = self.get_track_count();
let num_to_remove = to_remove.len();
for t in to_remove {
log::debug!("Remove '{}'", t);
match self.conn.execute("DELETE FROM Tracks WHERE File = ?;", params![t]) {
Ok(_) => { },
Err(_) => { }
Err(e) => { log::error!("Failed to remove '{}' - {}", t, e) }
}
}
let count_now = self.get_track_count();
if (count_now + num_to_remove) != count_before {
log::error!("Failed to remove all tracks. Count before: {}, wanted to remove: {}, count now: {}", count_before, num_to_remove, count_now);
}
}
}