2023-03-17 03:22:09 +00:00
|
|
|
/*
|
|
|
|
Program: Bibliofile
|
2023-05-01 20:31:08 +00:00
|
|
|
Language: Rustc 1.69.0
|
2023-05-15 18:33:14 +00:00
|
|
|
ide: CLion
|
2023-05-01 20:31:08 +00:00
|
|
|
Operating system: Fedora 38/WSL
|
2023-03-17 03:22:09 +00:00
|
|
|
Purpose: ncurses based ereader and library manager for Linux terminal environments.
|
2023-05-19 03:01:14 +00:00
|
|
|
Last edited: 5/18/23
|
2023-03-17 03:22:09 +00:00
|
|
|
*/
|
|
|
|
|
2023-05-15 18:33:14 +00:00
|
|
|
|
|
|
|
mod html_module;
|
|
|
|
use epub::doc::EpubDoc; //library for navigating epubs
|
2023-03-17 02:10:15 +00:00
|
|
|
use std::env;
|
2023-05-02 01:35:42 +00:00
|
|
|
use std::io;
|
2023-05-19 23:15:48 +00:00
|
|
|
|
2023-03-17 03:22:09 +00:00
|
|
|
|
2023-05-15 18:33:14 +00:00
|
|
|
|
2023-03-17 03:22:09 +00:00
|
|
|
//initial function. Reads the ebook passed by argument.
|
|
|
|
//TODO: add visual library to pull up ebooks.
|
2023-03-18 01:05:02 +00:00
|
|
|
fn main() {
|
2023-05-01 16:24:26 +00:00
|
|
|
let args: Vec<String> = env::args().collect();
|
|
|
|
let filename = &args[1];
|
2023-05-19 03:01:14 +00:00
|
|
|
epub_func(filename);
|
2023-03-18 01:05:02 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//parses epub files
|
2023-05-19 03:01:14 +00:00
|
|
|
fn epub_func(epub_file: &str){
|
|
|
|
//let item_count = 1;
|
2023-05-01 16:24:26 +00:00
|
|
|
let doc = EpubDoc::new(&epub_file);
|
|
|
|
assert!(doc.is_ok());
|
2023-05-02 00:26:22 +00:00
|
|
|
let mut doc = doc.unwrap();
|
|
|
|
doc.set_current_page(50);
|
2023-05-19 03:01:14 +00:00
|
|
|
let mut content = doc.get_current_str();
|
|
|
|
let mut str_content = content.unwrap();
|
|
|
|
let mut next = String::new();
|
|
|
|
|
|
|
|
|
|
|
|
|
2023-05-19 23:15:48 +00:00
|
|
|
let page = html_module::main(str_content);
|
|
|
|
println!("{}", page);
|
2023-05-02 00:26:22 +00:00
|
|
|
|
2023-03-18 01:05:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|