liboxen 0.53.0

Oxen is a fast data version control system, built with machine learning training data in mind. Designed to handle terabytes of data with ease, using a workflow similar to git. Version both structured and unstructured data of any modality: text, images, video, audio, CSV, Parquet, JSONL, model checkpoints, and more. liboxen is the embeddable core library behind the oxen CLI and server, which power fine tuning and inference pipelines for multimodal LLMs, image models, and video models on Oxen.ai.
use serde::{Deserialize, Serialize};
use utoipa::{IntoParams, ToSchema};

#[derive(Deserialize, Serialize, Debug, Clone, ToSchema)]
pub struct MetadataVideo {
    pub video: MetadataVideoImpl,
}

#[derive(Deserialize, Serialize, Debug, Clone, ToSchema)]
pub struct MetadataVideoImpl {
    pub num_seconds: f64,
    pub width: usize,
    pub height: usize,
}

#[derive(Deserialize, Debug, IntoParams, ToSchema)]
pub struct VideoThumbnail {
    #[schema(example = 320)]
    pub width: Option<u32>,
    #[schema(example = 240)]
    pub height: Option<u32>,
    #[schema(example = 1.0)]
    pub timestamp: Option<f64>,
    #[schema(example = true)]
    pub thumbnail: Option<bool>,
}

impl MetadataVideo {
    pub fn new(num_seconds: f64, width: usize, height: usize) -> Self {
        Self {
            video: MetadataVideoImpl {
                num_seconds,
                width,
                height,
            },
        }
    }
}

impl std::fmt::Display for MetadataVideo {
    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
        write!(
            f,
            "MetadataVideo({}x{} {}s)",
            self.video.width, self.video.height, self.video.num_seconds
        )
    }
}