pinakes-server: fix subtitle list response and registration
Signed-off-by: NotAShelf <raf@notashelf.dev> Change-Id: I22c7237877862acbf931ce4c662bd2816a6a6964
This commit is contained in:
parent
5e29de82eb
commit
fd11b2b7c4
5 changed files with 9 additions and 7 deletions
|
|
@ -35,6 +35,7 @@ pub enum SubtitleFormat {
|
|||
|
||||
impl SubtitleFormat {
|
||||
/// Returns the MIME type for this subtitle format.
|
||||
#[must_use]
|
||||
pub const fn mime_type(self) -> &'static str {
|
||||
match self {
|
||||
Self::Srt => "application/x-subrip",
|
||||
|
|
@ -45,6 +46,7 @@ impl SubtitleFormat {
|
|||
}
|
||||
|
||||
/// Returns true if this format is binary (not UTF-8 text).
|
||||
#[must_use]
|
||||
pub const fn is_binary(self) -> bool {
|
||||
matches!(self, Self::Pgs)
|
||||
}
|
||||
|
|
@ -96,6 +98,7 @@ pub struct SubtitleTrackInfo {
|
|||
/// Detects the subtitle format from a file extension.
|
||||
///
|
||||
/// Returns `None` if the extension is unrecognised or absent.
|
||||
#[must_use]
|
||||
pub fn detect_format(path: &Path) -> Option<SubtitleFormat> {
|
||||
match path.extension()?.to_str()?.to_lowercase().as_str() {
|
||||
"srt" => Some(SubtitleFormat::Srt),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue