Skip to content

Commit 52fd3aa

Browse files
committed
Bumping epub-rs to 2.1.4
1 parent 73625b3 commit 52fd3aa

File tree

3 files changed

+65
-100
lines changed

3 files changed

+65
-100
lines changed

Cargo.lock

Lines changed: 58 additions & 93 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ repository = "https://github.com/haydonryan/epub2audiobook"
77
authors = ["Haydon Ryan <[email protected]>"]
88

99
[dependencies]
10-
epub = "2.1.2"
10+
epub = "2.1.4"
1111
regex = "1.11.1"
1212
scraper = "0.21.0"
1313

src/main.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -181,15 +181,15 @@ fn get_chapter_titles(doc: &mut EpubDoc<BufReader<File>>) -> Vec<String> {
181181
let spine = doc.spine.clone();
182182

183183
for (i, current_section) in spine.iter().enumerate() {
184-
let path = doc.resources.get(current_section).unwrap().0.clone();
184+
let path = doc.resources.get(&current_section.idref).unwrap().0.clone();
185185
let text = doc.get_resource_by_path(&path).unwrap();
186186
let html = str::from_utf8(&text).unwrap();
187187
let chapter_number = i + 1;
188188

189189
let path_string: String = path.to_string_lossy().into();
190190
println!(
191191
"Processing chapter {}/{}: Section Name: {} Path: {}",
192-
chapter_number, number_of_ids, current_section, path_string,
192+
chapter_number, number_of_ids, current_section.idref, path_string,
193193
);
194194

195195
// Find matching TOC entries, otherwise push an empty string
@@ -252,7 +252,7 @@ fn convert_book(
252252
let spine = doc.spine.clone();
253253

254254
for (i, current_section) in spine.iter().enumerate() {
255-
let path = doc.resources.get(current_section).unwrap().0.clone();
255+
let path = doc.resources.get(&current_section.idref).unwrap().0.clone();
256256
let text = doc.get_resource_by_path(&path).unwrap();
257257
let html = str::from_utf8(&text).unwrap();
258258
let chapter_number = i + 1;
@@ -261,7 +261,7 @@ fn convert_book(
261261
let title_to_use = if title.len() > 2 {
262262
title
263263
} else {
264-
current_section
264+
&current_section.idref
265265
};
266266

267267
let filename = if title.len() > 2 {
@@ -270,13 +270,13 @@ fn convert_book(
270270
format!(
271271
"{:04}_{}",
272272
chapter_number,
273-
sanitize_filename(current_section)
273+
sanitize_filename(&current_section.idref)
274274
)
275275
};
276276

277277
println!(
278278
"Converting Chapter {:>3}/{}: {:<21} Title Source: TOC Filename: {}",
279-
chapter_number, number_of_ids, current_section, filename
279+
chapter_number, number_of_ids, &current_section.idref, filename
280280
);
281281

282282
output_to_file(

0 commit comments

Comments
 (0)