kill LibraryItem, unify to MediaItem; decouple schedule engine from providers
ADR-0001: MediaItem absorbs LibraryItem fields (provider_id, external_id, collection_name, collection_type, synced_at, role/MediaRole). LibraryItem + LibraryItemRow deleted. All ports/adapters/tests updated. ADR-0002: schedule engine takes LibraryQuery instead of IProviderRegistry. Algorithmic blocks query library via search(), manual blocks via get_by_id(). get_stream_url removed from engine; provider_registry moved to ScheduleDeps for playback-time stream URL resolution in application layer. BlockContent provider_id field removed (meaningless when querying library).
This commit is contained in:
@@ -48,7 +48,7 @@ async fn main() -> anyhow::Result<()> {
|
||||
let event_publisher: Arc<dyn domain::ports::EventPublisher> = event_bus.clone();
|
||||
|
||||
let schedule_engine = Arc::new(ScheduleEngineService::new(
|
||||
provider_registry.clone(),
|
||||
wire.library_query.clone(),
|
||||
wire.channel_query.clone(),
|
||||
wire.schedule_query.clone(),
|
||||
wire.schedule_command.clone(),
|
||||
@@ -70,6 +70,7 @@ async fn main() -> anyhow::Result<()> {
|
||||
schedule_query: wire.schedule_query.clone(),
|
||||
schedule_command: wire.schedule_command.clone(),
|
||||
event_publisher: event_publisher.clone(),
|
||||
provider_registry: provider_registry.clone(),
|
||||
});
|
||||
|
||||
let library_query_deps = Arc::new(application::library::LibraryQueryDeps {
|
||||
|
||||
@@ -171,7 +171,7 @@ impl KTvMcpServer {
|
||||
}
|
||||
|
||||
#[tool(
|
||||
description = "Search media items. content_type: movie|episode|short. Returns JSON array of LibraryItem."
|
||||
description = "Search media items. content_type: movie|episode|short. Returns JSON array of MediaItem."
|
||||
)]
|
||||
async fn search_media(&self, #[tool(aggr)] p: SearchMediaParams) -> String {
|
||||
library::search_media(
|
||||
|
||||
@@ -102,7 +102,7 @@ pub async fn search_media(
|
||||
let dtos: Vec<LibraryItemDto> = items
|
||||
.into_iter()
|
||||
.map(|i| LibraryItemDto {
|
||||
id: i.id().to_string(),
|
||||
id: i.id().value().to_string(),
|
||||
provider_id: i.provider_id().to_string(),
|
||||
external_id: i.external_id().to_string(),
|
||||
title: i.title().to_string(),
|
||||
|
||||
Reference in New Issue
Block a user