mirror of
https://github.com/lanyeeee/bilibili-video-downloader.git
synced 2026-05-06 20:02:57 +08:00
feat: 支持设置创建下载任务后是否自动开始
This commit is contained in:
@@ -43,6 +43,7 @@ pub struct Config {
|
||||
pub chunk_download_interval_sec: u64,
|
||||
pub danmaku_config: CanvasConfig,
|
||||
pub file_exist_action: FileExistAction,
|
||||
pub auto_start_download_task: bool,
|
||||
}
|
||||
|
||||
impl Config {
|
||||
@@ -153,6 +154,7 @@ impl Config {
|
||||
chunk_download_interval_sec: 0,
|
||||
danmaku_config: CanvasConfig::default(),
|
||||
file_exist_action: FileExistAction::Overwrite,
|
||||
auto_start_download_task: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -98,7 +98,14 @@ impl DownloadTask {
|
||||
tracing::error!(err_title, message = string_chain);
|
||||
}
|
||||
|
||||
let (state_sender, _) = watch::channel(DownloadTaskState::Pending);
|
||||
let auto_start = app.get_config().read().auto_start_download_task;
|
||||
let init_state = if auto_start {
|
||||
DownloadTaskState::Pending
|
||||
} else {
|
||||
DownloadTaskState::Paused
|
||||
};
|
||||
|
||||
let (state_sender, _) = watch::channel(init_state);
|
||||
let (restart_sender, _) = watch::channel(());
|
||||
let (cancel_sender, _) = watch::channel(());
|
||||
let (delete_sender, _) = watch::channel(());
|
||||
|
||||
Reference in New Issue
Block a user