MediaRole auto-detection + manual role API + sync wiring (#7)

role_detector: classify items as Interstitial by collection name/tag patterns.
Wire chapter extraction + role detection into sync adapter (worker + presentation).
SQLite: persist/read role column, migration.
PUT /library/items/{id}/role endpoint for manual override.
This commit is contained in:
2026-07-12 14:00:28 +02:00
parent 607d311375
commit f21d70c559
15 changed files with 304 additions and 21 deletions

View File

@@ -20,7 +20,7 @@ pub use config::{ConfigResponse, ProviderCapabilitiesResponse, ProviderInfo};
pub use iptv::IptvParams;
pub use library::{
CollectionResponse, GenresParams, LibraryItemResponse, LibrarySearchParams, ProviderParam,
SeasonResponse, SeasonsParams, ShowResponse, ShowsParams, SyncStatusEntry,
SeasonResponse, SeasonsParams, ShowResponse, ShowsParams, SyncStatusEntry, UpdateRoleRequest,
};
pub use providers::{ProviderConfigRequest, ProviderConfigResponse};
pub use schedule::{

View File

@@ -22,6 +22,7 @@ pub struct LibraryItemResponse {
pub collection_type: Option<String>,
pub thumbnail_url: Option<String>,
pub synced_at: Option<String>,
pub role: String,
}
impl From<domain::MediaItem> for LibraryItemResponse {
@@ -44,6 +45,7 @@ impl From<domain::MediaItem> for LibraryItemResponse {
collection_type: i.collection_type().map(|s| s.to_string()),
thumbnail_url: i.thumbnail_url().map(|s| s.to_string()),
synced_at: i.synced_at().map(|s| s.to_string()),
role: enum_to_string(i.role()),
}
}
}
@@ -166,3 +168,8 @@ pub struct GenresParams {
pub content_type: Option<String>,
pub provider: Option<String>,
}
#[derive(Debug, Deserialize, ToSchema)]
pub struct UpdateRoleRequest {
pub role: String,
}