PbDbFixer/src/main.rs

67 lines
1.9 KiB
Rust
Raw Normal View History

2021-02-17 16:20:57 +01:00
mod database;
2021-02-11 21:58:10 +01:00
mod epub;
2021-01-29 12:47:33 +01:00
mod pocketbook;
2021-01-30 17:59:00 +01:00
fn main() {
2021-02-02 09:52:50 +01:00
if cfg!(target_arch = "arm") {
let res = pocketbook::dialog(
pocketbook::Icon::None,
"PocketBook has sometimes problems parsing metadata.\n\
This app tries to fix some of these issues.\n\
(Note: The database file explore-3.db will be altered!)\n\
\n\
Please be patient - this might take a while.\n\
You will see a blank screen during the process.\n\
\n\
Proceed?",
&["Cancel", "Yes"],
);
if res == 1 {
return;
}
}
2021-02-17 16:20:57 +01:00
let stat = database::fix_db_entries();
2021-01-29 12:47:33 +01:00
if cfg!(target_arch = "arm") {
2021-02-12 09:34:58 +01:00
if stat.anything_fixed() == false {
pocketbook::dialog(
pocketbook::Icon::Info,
"The database seems to be ok.\n\
2021-02-02 20:11:13 +01:00
Nothing had to be fixed.",
&["OK"],
);
2021-01-29 12:47:33 +01:00
} else {
pocketbook::dialog(
pocketbook::Icon::Info,
2021-02-01 19:39:36 +01:00
&format!(
"Authors fixed: {}\n\
Sorting fixed: {}\n\
2021-02-10 10:31:44 +01:00
Genres fixed: {}\n\
2021-02-15 13:05:32 +01:00
Series fixed: {}\n\
Books cleaned from DB: {}",
2021-02-10 10:31:44 +01:00
&stat.authors_fixed,
&stat.sorting_fixed,
2021-02-10 10:31:44 +01:00
&stat.genres_fixed,
2021-02-15 13:05:32 +01:00
&stat.series_fixed,
2021-02-10 10:31:44 +01:00
&stat.ghost_books_cleaned
2021-02-01 19:39:36 +01:00
),
2021-02-02 09:52:50 +01:00
&["OK"],
2021-01-29 12:47:33 +01:00
);
}
2021-02-01 14:33:00 +01:00
} else {
2021-02-01 19:39:36 +01:00
println!(
"Authors fixed: {}\n\
Sorting fixed: {}\n\
2021-02-10 10:31:44 +01:00
Genres fixed: {}\n\
2021-02-15 13:05:32 +01:00
Series fixed: {}\n\
Books cleaned from DB: {}",
&stat.authors_fixed,
&stat.sorting_fixed,
&stat.genres_fixed,
2021-02-15 13:05:32 +01:00
&stat.series_fixed,
&stat.ghost_books_cleaned
2021-02-01 19:39:36 +01:00
);
2021-01-29 12:47:33 +01:00
}
2021-01-28 17:52:09 +01:00
}