mirror of
https://github.com/amtoaer/bili-sync.git
synced 2026-05-11 18:11:05 +08:00
37 lines
939 B
Rust
37 lines
939 B
Rust
use sea_orm::DatabaseConnection;
|
|
|
|
use crate::adapter::VideoSourceEnum;
|
|
use crate::bilibili::BiliClient;
|
|
use crate::config::Config;
|
|
use crate::downloader::Downloader;
|
|
|
|
#[derive(Clone, Copy)]
|
|
pub struct DownloadContext<'a> {
|
|
pub bili_client: &'a BiliClient,
|
|
pub video_source: &'a VideoSourceEnum,
|
|
pub template: &'a handlebars::Handlebars<'a>,
|
|
pub connection: &'a DatabaseConnection,
|
|
pub downloader: &'a Downloader,
|
|
pub config: &'a Config,
|
|
}
|
|
|
|
impl<'a> DownloadContext<'a> {
|
|
pub fn new(
|
|
bili_client: &'a BiliClient,
|
|
video_source: &'a VideoSourceEnum,
|
|
template: &'a handlebars::Handlebars<'a>,
|
|
connection: &'a DatabaseConnection,
|
|
downloader: &'a Downloader,
|
|
config: &'a Config,
|
|
) -> Self {
|
|
Self {
|
|
bili_client,
|
|
video_source,
|
|
template,
|
|
connection,
|
|
downloader,
|
|
config,
|
|
}
|
|
}
|
|
}
|