Skip to content

Commit

Permalink
fixed: check concurrent
Browse files Browse the repository at this point in the history
  • Loading branch information
zhifengle committed Oct 15, 2022
1 parent 6f51667 commit c381c36
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Rss2pan

将 Rss 订阅离线下载到网盘。目前支持 115
将 Rss 订阅离线下载到 115 网盘。

## 关于

Expand Down Expand Up @@ -30,7 +30,7 @@
```bash
# 查看帮助
rss2pan -h
# 直接运行。读取 rss.json,进行添加离线任务
# 直接运行。读取 rss.json,依次添加离线任务
rss2pan
# 并发请求 rss 网站。然后再添加 115 离线任务
rss2pan -m
Expand Down
2 changes: 1 addition & 1 deletion src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ pub fn build_app() -> Command<'static> {
fn t_cmd() {
let cmd = build_app();
let matches = cmd.clone().try_get_matches_from(["rss2pan", "-m"]).unwrap();
assert!(matches.contains_id("concurrent"));
assert_eq!(matches.get_one::<bool>("concurrent").copied(), Some(true));
let matches = cmd.clone().try_get_matches_from(["rss2pan"]).unwrap();
assert_eq!(matches.get_one::<bool>("concurrent").copied(), Some(false));
}
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ async fn main() -> anyhow::Result<()> {
}
return Ok(());
}
if matches.contains_id("concurrent") {
if matches.get_one::<bool>("concurrent").copied() == Some(true) {
if let Err(err) = execute_tasks(&service).await {
println!("{}", err);
}
Expand Down
11 changes: 10 additions & 1 deletion src/yiyiwu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,16 @@ impl Yiyiwu {
.filter(|item| !service.has_item(&item.magnet))
.map(|item| &*item.magnet)
.collect();
// log::debug!("tasks: {:?}", tasks);
// 测试用的开关
if std::env::var("RSS2PAN_LOG").is_ok() {
log::info!(
"[RSS2PAN_LOG] [{}] [{}] has {} tasks",
config.name,
config.url,
tasks.len()
);
continue;
}
if tasks.len() == 0 {
log::info!("[{}] has 0 task", config.name);
continue;
Expand Down

0 comments on commit c381c36

Please sign in to comment.