domain: neutral StreamKind for media streams (phase 4d)
Add StreamKind enum (audio/video/subtitle/other) to the domain module with a total stream_kind_from_jellyfin mapper. MediaStream gains a kind field (dual-carry), populated at the mapping seam. Frontend VideoPlayer track/ subtitle selection and the channel-video check now use stream.kind instead of the Jellyfin stream.type string. Rust 456 (+ stream_kinds_map test), frontend 644, check clean.
This commit is contained in:
@@ -658,6 +658,7 @@ impl JellyfinItem {
|
||||
streams
|
||||
.into_iter()
|
||||
.map(|s| crate::repository::types::MediaStream {
|
||||
kind: crate::domain::stream_kind_from_jellyfin(&s.stream_type),
|
||||
stream_type: s.stream_type,
|
||||
codec: s.codec,
|
||||
language: s.language,
|
||||
|
||||
@@ -205,8 +205,13 @@ pub struct MediaItem {
|
||||
#[derive(specta::Type, Debug, Clone, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct MediaStream {
|
||||
/// Legacy Jellyfin stream type string ("Audio"/"Video"/"Subtitle"). Being
|
||||
/// replaced by `kind`; dual-carried while the frontend migrates.
|
||||
#[serde(rename = "type")]
|
||||
pub stream_type: String,
|
||||
/// Provider-neutral stream classification — replaces `stream_type`.
|
||||
#[serde(default)]
|
||||
pub kind: crate::domain::StreamKind,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub codec: Option<String>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
|
||||
Reference in New Issue
Block a user