feat: 支持各种任务结束之后的 delay 配置 (#148)

This commit is contained in:
ᴀᴍᴛᴏᴀᴇʀ
2024-07-23 22:29:25 +08:00
committed by GitHub
parent d46881aea6
commit 3a8f33d273
8 changed files with 68 additions and 14 deletions
+4
View File
@@ -18,6 +18,7 @@ use crate::bilibili::{BestStream, BiliClient, BiliError, Dimension, PageInfo, Vi
use crate::config::{ARGS, CONFIG, TEMPLATE};
use crate::downloader::Downloader;
use crate::error::{DownloadAbortError, ProcessPageError};
use crate::utils::delay;
use crate::utils::model::{create_videos, update_pages_model, update_videos_model};
use crate::utils::nfo::{ModelWrapper, NFOMode, NFOSerializer};
use crate::utils::status::{PageStatus, VideoStatus};
@@ -59,6 +60,7 @@ pub async fn refresh_video_list<'a>(
info!("到达上一次处理的位置,提前中止");
break;
}
delay(CONFIG.delay.refresh_video_list.as_ref()).await;
}
new_count = video_list_model.video_count(connection).await? - new_count;
video_list_model.log_refresh_video_end(got_count, new_count);
@@ -226,6 +228,7 @@ pub async fn download_video_pages(
}
let mut video_active_model: video::ActiveModel = video_model.into();
video_active_model.download_status = Set(status.into());
delay(CONFIG.delay.download_video.as_ref()).await;
Ok(video_active_model)
}
@@ -411,6 +414,7 @@ pub async fn download_page(
let mut page_active_model: page::ActiveModel = page_model.into();
page_active_model.download_status = Set(status.into());
page_active_model.path = Set(Some(video_path.to_str().unwrap().to_string()));
delay(CONFIG.delay.download_page.as_ref()).await;
Ok(page_active_model)
}