feat(channel): add auto-schedule feature to channels with background scheduler
This commit is contained in:
@@ -21,6 +21,7 @@ mod dto;
|
||||
mod error;
|
||||
mod extractors;
|
||||
mod routes;
|
||||
mod scheduler;
|
||||
mod state;
|
||||
|
||||
use crate::config::Config;
|
||||
@@ -72,6 +73,7 @@ async fn main() -> anyhow::Result<()> {
|
||||
// Build media provider — Jellyfin if configured, no-op fallback otherwise.
|
||||
let media_provider: Arc<dyn IMediaProvider> = build_media_provider(&config);
|
||||
|
||||
let bg_channel_repo = channel_repo.clone();
|
||||
let schedule_engine = ScheduleEngineService::new(
|
||||
Arc::clone(&media_provider),
|
||||
channel_repo,
|
||||
@@ -91,6 +93,9 @@ async fn main() -> anyhow::Result<()> {
|
||||
cors_origins: config.cors_allowed_origins.clone(),
|
||||
};
|
||||
|
||||
let bg_schedule_engine = Arc::clone(&state.schedule_engine);
|
||||
tokio::spawn(scheduler::run_auto_scheduler(bg_schedule_engine, bg_channel_repo));
|
||||
|
||||
let app = Router::new()
|
||||
.nest("/api/v1", routes::api_v1_router())
|
||||
.with_state(state);
|
||||
|
||||
Reference in New Issue
Block a user