summaryrefslogtreecommitdiff
path: root/src/epub.rs
diff options
context:
space:
mode:
authorA Farzat <a@farzat.xyz>2026-11-04 15:25:31 +0300
committerA Farzat <a@farzat.xyz>2026-11-04 15:35:27 +0300
commit3d54b73266646f73e855a175dbfd86ca2d50ba96 (patch)
tree07708ce988d1d70b2d79af360338398a640975ad /src/epub.rs
parent1020098497c37b7acfe3ff70845db58c3de22f98 (diff)
downloadoreilly-epub-0.1.4.tar.gz
oreilly-epub-0.1.4.zip
Record the O'Reilly bookid in the generated EPUBHEADv0.1.4master
Store the O'Reilly bookid as EPUB metadata instead of relying solely on the filename. Preserving the original bookid makes it possible to look up additional information from the upstream O'Reilly resource later, even if the EPUB is renamed or imported into a library manager.
Diffstat (limited to 'src/epub.rs')
-rw-r--r--src/epub.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/epub.rs b/src/epub.rs
index 1336115..96b1f2c 100644
--- a/src/epub.rs
+++ b/src/epub.rs
@@ -96,6 +96,7 @@ pub async fn download_one_file(
/// Creates the EPUB archive (creates zip and includes all files in it).
pub fn create_epub_archive(
+ bookid: &str,
epub_data: &EpubResponse,
epub_root: &Path,
output_epub: &Path,
@@ -154,7 +155,7 @@ pub fn create_epub_archive(
&mut zip,
)?;
} else if entry.ourn == opf_entry.ourn {
- write_modified_opf(buf_reader, &mut zip, &epub_data.descriptions.plain)?;
+ write_modified_opf(buf_reader, &mut zip, bookid, &epub_data.descriptions.plain)?;
} else {
std::io::copy(&mut buf_reader, &mut zip)?;
}