aboutsummaryrefslogtreecommitdiff
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index 8c5c712..002f669 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -5,7 +5,7 @@ mod models;
use std::collections::HashMap;
use std::path::Path;
-use crate::epub::{download_all_files,};
+use crate::epub::{create_epub_archive, download_all_files};
use crate::http_client::build_authenticated_client;
use crate::models::{Chapter, EpubResponse, FileEntry, Paginated, SpineItem, TocNode};
use anyhow::{Context, Result, ensure};
@@ -115,6 +115,9 @@ async fn main() -> Result<()> {
let dest_root = format!("Books/{}/epub_root", args.bookid);
let dest_root = Path::new(&dest_root);
download_all_files(&client, &file_entries, dest_root).await?;
+ let epub_path = format!("Books/{0}/{0}.epub", args.bookid);
+ let epub_path = Path::new(&epub_path);
+ create_epub_archive(dest_root, &epub_path, &file_entries)?;
// Sanity check: Every entry in spine exists in chapters.
let chapters: HashMap<String, Chapter> =