From 78267afbe9a6528ba08f307b578380e90a21b151 Mon Sep 17 00:00:00 2001 From: Steven Vandevelde Date: Fri, 9 Feb 2024 16:27:47 +0100 Subject: [PATCH] closes #401 --- src/Javascript/common.ts | 6 ++++-- src/Library/Sources/Pick.elm | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Javascript/common.ts b/src/Javascript/common.ts index 3bc5649c..91cecba5 100644 --- a/src/Javascript/common.ts +++ b/src/Javascript/common.ts @@ -34,7 +34,7 @@ export function db(storeName: string = "main"): LocalForage { } -export function fileExtension(mimeType) { +export function fileExtension(mimeType: string): string | undefined { const audioId = mimeType.toLowerCase().split("/")[ 1 ] switch (audioId) { @@ -48,6 +48,7 @@ export function fileExtension(mimeType) { case "flac": return "flac"; case "x-flac": return "flac"; case "ogg": return "ogg"; + case "opus": return "opus"; case "wav": return "wav"; case "wave": return "wav"; @@ -57,13 +58,14 @@ export function fileExtension(mimeType) { } -export function mimeType(fileExt) { +export function mimeType(fileExt: string): string | undefined { switch (fileExt) { case "mp3": return "audio/mpeg"; case "mp4": return "audio/mp4"; case "m4a": return "audio/mp4"; case "flac": return "audio/flac"; case "ogg": return "audio/ogg"; + case "opus": return "audio/opus"; case "wav": return "audio/wave"; case "webm": return "audio/webm"; } diff --git a/src/Library/Sources/Pick.elm b/src/Library/Sources/Pick.elm index 50aa0a2d..c9d4205b 100644 --- a/src/Library/Sources/Pick.elm +++ b/src/Library/Sources/Pick.elm @@ -25,6 +25,6 @@ selectMusicFiles = musicFileRegex : Regex.Regex musicFileRegex = - "\\.(mp3|mp4|m4a|flac|ogg|wav|webm)$" + "\\.(mp3|mp4|m4a|flac|ogg|opus|wav|webm)$" |> Regex.fromStringWith { caseInsensitive = True, multiline = False } |> Maybe.withDefault Regex.never -- 2.51.2