treewide: fix various UI bugs; optimize crypto dependencies & format
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: If8fe8b38c1d9c4fecd40ff71f88d2ae06a6a6964
This commit is contained in:
parent
764aafa88d
commit
3ccddce7fd
178 changed files with 58342 additions and 54241 deletions
|
|
@ -11,52 +11,52 @@ use crate::model::MediaId;
|
|||
/// A subtitle track associated with a media item.
|
||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||
pub struct Subtitle {
|
||||
pub id: Uuid,
|
||||
pub media_id: MediaId,
|
||||
pub language: Option<String>,
|
||||
pub format: SubtitleFormat,
|
||||
pub file_path: Option<PathBuf>,
|
||||
pub is_embedded: bool,
|
||||
pub track_index: Option<usize>,
|
||||
pub offset_ms: i64,
|
||||
pub created_at: DateTime<Utc>,
|
||||
pub id: Uuid,
|
||||
pub media_id: MediaId,
|
||||
pub language: Option<String>,
|
||||
pub format: SubtitleFormat,
|
||||
pub file_path: Option<PathBuf>,
|
||||
pub is_embedded: bool,
|
||||
pub track_index: Option<usize>,
|
||||
pub offset_ms: i64,
|
||||
pub created_at: DateTime<Utc>,
|
||||
}
|
||||
|
||||
/// Supported subtitle formats.
|
||||
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "lowercase")]
|
||||
pub enum SubtitleFormat {
|
||||
Srt,
|
||||
Vtt,
|
||||
Ass,
|
||||
Ssa,
|
||||
Pgs,
|
||||
Srt,
|
||||
Vtt,
|
||||
Ass,
|
||||
Ssa,
|
||||
Pgs,
|
||||
}
|
||||
|
||||
impl std::fmt::Display for SubtitleFormat {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
let s = match self {
|
||||
Self::Srt => "srt",
|
||||
Self::Vtt => "vtt",
|
||||
Self::Ass => "ass",
|
||||
Self::Ssa => "ssa",
|
||||
Self::Pgs => "pgs",
|
||||
};
|
||||
write!(f, "{s}")
|
||||
}
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
let s = match self {
|
||||
Self::Srt => "srt",
|
||||
Self::Vtt => "vtt",
|
||||
Self::Ass => "ass",
|
||||
Self::Ssa => "ssa",
|
||||
Self::Pgs => "pgs",
|
||||
};
|
||||
write!(f, "{s}")
|
||||
}
|
||||
}
|
||||
|
||||
impl std::str::FromStr for SubtitleFormat {
|
||||
type Err = String;
|
||||
type Err = String;
|
||||
|
||||
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
|
||||
match s {
|
||||
"srt" => Ok(Self::Srt),
|
||||
"vtt" => Ok(Self::Vtt),
|
||||
"ass" => Ok(Self::Ass),
|
||||
"ssa" => Ok(Self::Ssa),
|
||||
"pgs" => Ok(Self::Pgs),
|
||||
_ => Err(format!("unknown subtitle format: {s}")),
|
||||
}
|
||||
fn from_str(s: &str) -> std::result::Result<Self, Self::Err> {
|
||||
match s {
|
||||
"srt" => Ok(Self::Srt),
|
||||
"vtt" => Ok(Self::Vtt),
|
||||
"ass" => Ok(Self::Ass),
|
||||
"ssa" => Ok(Self::Ssa),
|
||||
"pgs" => Ok(Self::Pgs),
|
||||
_ => Err(format!("unknown subtitle format: {s}")),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue