pinakes-server: fix subtitle list response and registration

Signed-off-by: NotAShelf <raf@notashelf.dev>
Change-Id: I22c7237877862acbf931ce4c662bd2816a6a6964
This commit is contained in:
raf 2026-03-21 13:33:29 +03:00
commit fd11b2b7c4
Signed by: NotAShelf
GPG key ID: 29D95B64378DB4BF
5 changed files with 9 additions and 7 deletions

View file

@ -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),