diff --git a/crates/pinakes-server/src/dto/subtitles.rs b/crates/pinakes-server/src/dto/subtitles.rs index a3203ef..1b79e8a 100644 --- a/crates/pinakes-server/src/dto/subtitles.rs +++ b/crates/pinakes-server/src/dto/subtitles.rs @@ -1,14 +1,14 @@ use chrono::{DateTime, Utc}; use serde::{Deserialize, Serialize}; -#[derive(Debug, Serialize)] +#[derive(Debug, Serialize, utoipa::ToSchema)] pub struct SubtitleResponse { pub id: String, pub media_id: String, pub language: Option, pub format: String, pub is_embedded: bool, - pub track_index: Option, + pub track_index: Option, pub offset_ms: i64, pub created_at: DateTime, } @@ -28,17 +28,46 @@ impl From for SubtitleResponse { } } -#[derive(Debug, Deserialize)] +#[derive(Debug, Deserialize, utoipa::ToSchema)] pub struct AddSubtitleRequest { pub language: Option, pub format: String, pub file_path: Option, pub is_embedded: Option, - pub track_index: Option, + pub track_index: Option, pub offset_ms: Option, } -#[derive(Debug, Deserialize)] +#[derive(Debug, Deserialize, utoipa::ToSchema)] pub struct UpdateSubtitleOffsetRequest { pub offset_ms: i64, } + +/// Information about an embedded subtitle track available for extraction. +#[derive(Debug, Serialize, utoipa::ToSchema)] +pub struct SubtitleTrackInfoResponse { + pub index: u32, + pub language: Option, + pub format: String, + pub title: Option, +} + +impl From + for SubtitleTrackInfoResponse +{ + fn from(t: pinakes_core::subtitles::SubtitleTrackInfo) -> Self { + Self { + index: t.index, + language: t.language, + format: t.format.to_string(), + title: t.title, + } + } +} + +/// Response for listing subtitles on a media item. +#[derive(Debug, Serialize, utoipa::ToSchema)] +pub struct SubtitleListResponse { + pub subtitles: Vec, + pub available_tracks: Vec, +}