mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-31 20:24:27 -04:00
Add identify types
This commit is contained in:
parent
f80289aef1
commit
ea52ce1c65
@ -2,7 +2,39 @@ use serde::Serialize;
|
|||||||
|
|
||||||
#[derive(Serialize)]
|
#[derive(Serialize)]
|
||||||
pub struct MediaInfo {
|
pub struct MediaInfo {
|
||||||
|
container: String,
|
||||||
|
video_codec: String,
|
||||||
|
audios: Vec<Track>,
|
||||||
|
subtitles: Vec<Track>,
|
||||||
|
fonts: Vec<String>,
|
||||||
|
chapters: Vec<Chapter>,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize)]
|
||||||
|
pub struct Track {
|
||||||
|
/// The index of this track on the media.
|
||||||
|
index: u32,
|
||||||
|
/// The title of the stream.
|
||||||
|
title: String,
|
||||||
|
/// The language of this stream (as a ISO-639-2 language code)
|
||||||
|
language: String,
|
||||||
|
/// The codec of this stream.
|
||||||
|
codec: String,
|
||||||
|
/// Is this stream the default one of it's type?
|
||||||
|
default: bool,
|
||||||
|
/// Is this stream tagged as forced? (useful only for subtitles)
|
||||||
|
forced: bool,
|
||||||
|
}
|
||||||
|
|
||||||
|
#[derive(Serialize)]
|
||||||
|
pub struct Chapter {
|
||||||
|
/// The start time of the chapter (in second from the start of the episode).
|
||||||
|
start: f32,
|
||||||
|
/// The end time of the chapter (in second from the start of the episode).
|
||||||
|
end: f32,
|
||||||
|
/// The name of this chapter. This should be a human-readable name that could be presented to the user.
|
||||||
|
name: String
|
||||||
|
// TODO: add a type field for Opening, Credits...
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn identify(path: String) -> Result<MediaInfo, std::io::Error> {
|
pub fn identify(path: String) -> Result<MediaInfo, std::io::Error> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user