Skip to content

Commit

Permalink
更新 0.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
lihe committed May 18, 2022
1 parent e4e06d6 commit 4642417
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "bcdown"
version = "0.1.2"
version = "0.1.3"
edition = "2021"
authors = ["lihe07"]
description = "Bilibili漫画下载器,written in Rust"
Expand Down
2 changes: 1 addition & 1 deletion src/lib/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ async fn run_task(
};

let not_downloaded = ep_cache.not_downloaded();
for (i, url) in network::get_image_tokens(&config, not_downloaded.clone()).await.unwrap().iter().enumerate() {
for (i, url) in network::get_image_tokens(&config, not_downloaded.clone()).await?.iter().enumerate() { // 出错的概率很低,但不是没有
if halt_receiver.try_recv().is_ok() {
return None;
}
Expand Down
8 changes: 4 additions & 4 deletions src/lib/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ pub struct ComicInfo {
pub author_name: Vec<String>,
pub styles: Vec<String>,
pub ep_list: Vec<EpisodeInfo>,
pub vertical_cover: String
pub vertical_cover: String,
}

pub async fn get_comic_info(config: &Config, comic_id: u32) -> ComicInfo {
Expand Down Expand Up @@ -241,9 +241,9 @@ pub async fn get_image_tokens(config: &Config, paths: Vec<String>) -> Option<Vec
}

pub async fn down_to<T: AsRef<Path>>(config: &Config, url: String, path: T) -> Option<usize> {
if path.as_ref().is_file() {
panic!("重复下载文件: {}", path.as_ref().display());
}
// if path.as_ref().is_file() {
// panic!("重复下载文件: {}", path.as_ref().display());
// }
let client = config.get_client();
let resp = client.get(url).send().await.ok()?; // 这里出错是在计划内的,不会强制退出

Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ async fn main() {
let to = matches.value_of("to").unwrap_or("-1").parse::<f64>().unwrap();
let split = matches.is_present("split_pdf");
let format = matches.value_of("format").unwrap();
if format != "epub" && format != "epub" {
if format != "epub" && format != "pdf" {
log.error("目前只支持导出epub和pdf格式");
return;
}
Expand Down

0 comments on commit 4642417

Please sign in to comment.