- Introduced `TranscodeManager` for managing on-demand transcoding of local video files. - Added configuration options for transcoding in `Config` and `LocalFilesConfig`. - Implemented new API routes for managing transcoding settings, stats, and cache. - Updated `LocalFilesProvider` to support transcoding capabilities. - Created frontend components for managing transcode settings and displaying stats. - Added database migration for transcode settings. - Enhanced existing routes and DTOs to accommodate new transcoding features.
45 lines
1.3 KiB
Rust
45 lines
1.3 KiB
Rust
use axum::{Json, Router, extract::State, routing::get};
|
|
use domain::{IProviderRegistry as _, ProviderCapabilities, StreamingProtocol};
|
|
|
|
use crate::dto::{ConfigResponse, ProviderInfo};
|
|
use crate::state::AppState;
|
|
|
|
pub fn router() -> Router<AppState> {
|
|
Router::new().route("/", get(get_config))
|
|
}
|
|
|
|
async fn get_config(State(state): State<AppState>) -> Json<ConfigResponse> {
|
|
let providers: Vec<ProviderInfo> = state
|
|
.provider_registry
|
|
.provider_ids()
|
|
.into_iter()
|
|
.filter_map(|id| {
|
|
state.provider_registry.capabilities(&id).map(|caps| ProviderInfo {
|
|
id: id.clone(),
|
|
capabilities: caps,
|
|
})
|
|
})
|
|
.collect();
|
|
|
|
let primary_capabilities = state
|
|
.provider_registry
|
|
.capabilities(state.provider_registry.primary_id())
|
|
.unwrap_or(ProviderCapabilities {
|
|
collections: false,
|
|
series: false,
|
|
genres: false,
|
|
tags: false,
|
|
decade: false,
|
|
search: false,
|
|
streaming_protocol: StreamingProtocol::DirectFile,
|
|
rescan: false,
|
|
transcode: false,
|
|
});
|
|
|
|
Json(ConfigResponse {
|
|
allow_registration: state.config.allow_registration,
|
|
providers,
|
|
provider_capabilities: primary_capabilities,
|
|
})
|
|
}
|