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:
2026-07-12 07:02:08 +02:00
parent 773e228e21
commit a6558e15b2
30 changed files with 324 additions and 354 deletions

View File

@@ -2,7 +2,7 @@ use async_trait::async_trait;
use crate::errors::DomainResult;
use crate::models::{
LibraryCollection, LibraryItem, LibrarySyncLogEntry, LibrarySyncResult,
LibraryCollection, LibrarySyncLogEntry, LibrarySyncResult, MediaItem,
SeasonSummary, ShowSummary,
};
use crate::value_objects::{ContentType, LibrarySearchFilter};
@@ -11,7 +11,7 @@ use super::media::IMediaProvider;
#[async_trait]
pub trait LibraryCommand: Send + Sync {
async fn upsert_items(&self, provider_id: &str, items: Vec<LibraryItem>) -> DomainResult<()>;
async fn upsert_items(&self, provider_id: &str, items: Vec<MediaItem>) -> DomainResult<()>;
async fn clear_provider(&self, provider_id: &str) -> DomainResult<()>;
@@ -25,9 +25,9 @@ pub trait LibraryQuery: Send + Sync {
async fn search(
&self,
filter: &LibrarySearchFilter,
) -> DomainResult<(Vec<LibraryItem>, u32)>;
) -> DomainResult<(Vec<MediaItem>, u32)>;
async fn get_by_id(&self, id: &str) -> DomainResult<Option<LibraryItem>>;
async fn get_by_id(&self, id: &str) -> DomainResult<Option<MediaItem>>;
async fn list_collections(
&self,