Skip to content

Commit

Permalink
更新 v0.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
lihe committed May 22, 2022
1 parent 9c511bb commit 61df970
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
[package]
name = "bcdown"
version = "0.1.5"
version = "0.1.6"
edition = "2021"
authors = ["lihe07"]
description = "Bilibili漫画下载器,written in Rust"
description = "Bilibili漫画下载器,written in Rust,支持epub pdf zip格式"
repository = "https://github.com/lihe07/bilibili_comics_downloader"
license = "MIT"

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@
- 0.1.3 - 修复bug
- 0.1.4 - 修复bug,优化网络模块
- 0.1.5 - 加入导出zip文件的支持,修复bug,优化任务处理
- 0.1.6 - 删除书签中的ORD编码,修复epub中的格式问题

## 补充

Expand Down
10 changes: 5 additions & 5 deletions src/lib/exports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub fn export_pdf(
ep_dir.join(file_name)
}).collect::<Vec<_>>();

let doc = pdf::from_images(paths, ep.title.clone(), format!("{} - {}", ep.ord, ep.title.clone()), config.dpi.clone());
let doc = pdf::from_images(paths, ep.title.clone(), ep.title.clone(), config.dpi.clone());
let path = ep_dir.join(
if let Some(dpi) = config.dpi {
format!("{}-dpi.pdf", dpi)
Expand Down Expand Up @@ -61,9 +61,9 @@ pub fn export_pdf(
ep_dir.join(file_name)
}).collect::<Vec<_>>();
if i == 0 {
pdf = Some(pdf::from_images(paths, comic_cache.title.clone(), format!("{} - {}", ep.ord, ep.title.clone()), config.dpi.clone()));
pdf = Some(pdf::from_images(paths, comic_cache.title.clone(), ep.title.clone(), config.dpi.clone()));
} else {
pdf = Some(pdf::append(pdf.unwrap(), paths, format!("{} - {}", ep.ord, ep.title.clone()), config.dpi.clone()));
pdf = Some(pdf::append(pdf.unwrap(), paths, ep.title.clone(), config.dpi.clone()));
}
}
log.done();
Expand Down Expand Up @@ -115,7 +115,7 @@ pub fn export_epub(
if let Some(cover) = cover.clone() {
builder.add_cover_image("images/cover.jpg", cover.as_slice(), "image/jpeg").unwrap();
}
builder.metadata("title", format!("{} {} - {}", &comic_cache.title, ep.ord, &ep.title)).unwrap();
builder.metadata("title", format!("{} - {}", &comic_cache.title, &ep.title)).unwrap();
builder.stylesheet(style.as_bytes()).unwrap();
for (i, link) in ep.paths.iter().enumerate() {
let file_name = link.split('/').last().unwrap();
Expand Down Expand Up @@ -170,7 +170,7 @@ pub fn export_epub(
if i == 0 {
builder.add_content(
EpubContent::new(format!("{}.xhtml", ep.id), content_template.replace("{src}", &format!("./images/{}/{}", ep.id, file_name)).replace("{alt}", link).as_bytes())
.title(format!("{} - {}", ep.ord, ep.title))
.title(&ep.title)
).unwrap();
} else {
builder.add_content(
Expand Down
11 changes: 7 additions & 4 deletions src/lib/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -377,8 +377,11 @@ pub async fn fetch(id_or_link: String, from: f64, to: f64) {

let (statics_sender, mut statics_receiver) = tokio::sync::mpsc::channel(10);
let (halt_sender, halt_receiver) = crossbeam::channel::unbounded();
let times = ep_list.len();
ctrlc::set_handler(move || {
halt_sender.send(()).unwrap();
for _ in 0..times {
halt_sender.send(()).unwrap();
}
}).expect("无法设置 ctrl+c 处理函数");

let mut tasks = Vec::new();
Expand Down Expand Up @@ -511,7 +514,7 @@ pub fn export(id_or_link: String, from: f64, to: f64, split_episodes: bool, expo
&config,
bar,
out_dir,
comic_cache
comic_cache,
);
} else if format == "epub" {
exports::export_epub(
Expand All @@ -520,7 +523,7 @@ pub fn export(id_or_link: String, from: f64, to: f64, split_episodes: bool, expo
ep_list,
bar,
out_dir,
comic_cache
comic_cache,
);
} else if format == "zip" {
exports::export_zip(
Expand All @@ -529,7 +532,7 @@ pub fn export(id_or_link: String, from: f64, to: f64, split_episodes: bool, expo
ep_list,
bar,
out_dir,
comic_cache
comic_cache,
);
}
log.success(format!("漫画导出至: {}", out));
Expand Down

0 comments on commit 61df970

Please sign in to comment.