Code reorganized.
This commit is contained in:
parent
3f5d790d3c
commit
a9ef4d2aef
1 changed files with 45 additions and 40 deletions
17
src/main.rs
17
src/main.rs
|
@ -1,6 +1,6 @@
|
|||
mod pocketbook;
|
||||
|
||||
use rusqlite::{named_params, Connection, Result, NO_PARAMS};
|
||||
use rusqlite::{named_params, Connection, Result, Transaction, NO_PARAMS};
|
||||
use std::error::Error;
|
||||
use std::fs::File;
|
||||
use std::io::BufReader;
|
||||
|
@ -111,12 +111,9 @@ struct BookEntry {
|
|||
filepath: String,
|
||||
}
|
||||
|
||||
fn main() {
|
||||
fn fix_firstauthor(tx: &Transaction) -> i32 {
|
||||
let mut authors_fixed = 0;
|
||||
|
||||
let mut conn = Connection::open("/mnt/ext1/system/explorer-3/explorer-3.db").unwrap();
|
||||
let tx = conn.transaction().unwrap();
|
||||
{
|
||||
// Get book ids from entries where we have something like "firstname lastname" in author
|
||||
// but no "lastname, firstname" in fistauthor
|
||||
// Get also book ids from the special case where we have multiple authors (separated by ", " in authors)
|
||||
|
@ -171,7 +168,15 @@ fn main() {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
authors_fixed
|
||||
}
|
||||
|
||||
fn main() {
|
||||
let mut conn = Connection::open("/mnt/ext1/system/explorer-3/explorer-3.db").unwrap();
|
||||
|
||||
let tx = conn.transaction().unwrap();
|
||||
let authors_fixed = fix_firstauthor(&tx);
|
||||
tx.commit().unwrap();
|
||||
|
||||
if cfg!(target_arch = "arm") {
|
||||
|
|
Loading…
Reference in a new issue