From 01e8d9e1efc23882991518e183f8964e6b9358e4 Mon Sep 17 00:00:00 2001 From: kim Date: Sat, 20 Jul 2024 17:21:46 +0100 Subject: [PATCH 1/3] add flac support to the ffprobe format/stream -> filetype parser --- internal/media/ffmpeg.go | 2 ++ internal/media/manager.go | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/internal/media/ffmpeg.go b/internal/media/ffmpeg.go index 6d4c9ac87b..ce90028af6 100644 --- a/internal/media/ffmpeg.go +++ b/internal/media/ffmpeg.go @@ -335,6 +335,8 @@ func (res *result) GetFileType() (gtsmodel.FileType, string) { } case "avi": return gtsmodel.FileTypeVideo, "avi" + case "flac": + return gtsmodel.FileTypeAudio, "flac" } return gtsmodel.FileTypeUnknown, res.format } diff --git a/internal/media/manager.go b/internal/media/manager.go index 13bcebe795..31ddde1f02 100644 --- a/internal/media/manager.go +++ b/internal/media/manager.go @@ -38,8 +38,9 @@ var SupportedMIMETypes = []string{ "image/gif", // .gif "image/webp", // .webp - "audio/mp2", // .mp2 - "audio/mp3", // .mp3 + "audio/mp2", // .mp2 + "audio/mp3", // .mp3 + "audio/x-flac", // .flac "video/x-msvideo", // .avi From 021c957d4bddf10d7cb17f8ac5d03fcaada493a6 Mon Sep 17 00:00:00 2001 From: kim Date: Sat, 20 Jul 2024 22:42:48 +0100 Subject: [PATCH 2/3] also add audio/flac for flac (not just x-flac) --- internal/media/manager.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/internal/media/manager.go b/internal/media/manager.go index 31ddde1f02..0099dfe076 100644 --- a/internal/media/manager.go +++ b/internal/media/manager.go @@ -38,12 +38,14 @@ var SupportedMIMETypes = []string{ "image/gif", // .gif "image/webp", // .webp - "audio/mp2", // .mp2 - "audio/mp3", // .mp3 - "audio/x-flac", // .flac + "audio/mp2", // .mp2 + "audio/mp3", // .mp3 "video/x-msvideo", // .avi + "audio/flac", // .flac + "audio/x-flac", // .flac + // png types "image/png", // .png "image/apng", // .apng From 1701dce0ce401adb86bb78f88bea5cf54f6ad92a Mon Sep 17 00:00:00 2001 From: tobi Date: Sun, 21 Jul 2024 14:21:04 +0200 Subject: [PATCH 3/3] update tests --- internal/api/client/instance/instancepatch_test.go | 12 ++++++++++++ internal/typeutils/internaltofrontend_test.go | 4 ++++ 2 files changed, 16 insertions(+) diff --git a/internal/api/client/instance/instancepatch_test.go b/internal/api/client/instance/instancepatch_test.go index ba0d026f38..34fbc6e606 100644 --- a/internal/api/client/instance/instancepatch_test.go +++ b/internal/api/client/instance/instancepatch_test.go @@ -109,6 +109,8 @@ func (suite *InstancePatchTestSuite) TestInstancePatch1() { "audio/mp2", "audio/mp3", "video/x-msvideo", + "audio/flac", + "audio/x-flac", "image/png", "image/apng", "audio/ogg", @@ -243,6 +245,8 @@ func (suite *InstancePatchTestSuite) TestInstancePatch2() { "audio/mp2", "audio/mp3", "video/x-msvideo", + "audio/flac", + "audio/x-flac", "image/png", "image/apng", "audio/ogg", @@ -377,6 +381,8 @@ func (suite *InstancePatchTestSuite) TestInstancePatch3() { "audio/mp2", "audio/mp3", "video/x-msvideo", + "audio/flac", + "audio/x-flac", "image/png", "image/apng", "audio/ogg", @@ -562,6 +568,8 @@ func (suite *InstancePatchTestSuite) TestInstancePatch6() { "audio/mp2", "audio/mp3", "video/x-msvideo", + "audio/flac", + "audio/x-flac", "image/png", "image/apng", "audio/ogg", @@ -718,6 +726,8 @@ func (suite *InstancePatchTestSuite) TestInstancePatch8() { "audio/mp2", "audio/mp3", "video/x-msvideo", + "audio/flac", + "audio/x-flac", "image/png", "image/apng", "audio/ogg", @@ -889,6 +899,8 @@ func (suite *InstancePatchTestSuite) TestInstancePatch9() { "audio/mp2", "audio/mp3", "video/x-msvideo", + "audio/flac", + "audio/x-flac", "image/png", "image/apng", "audio/ogg", diff --git a/internal/typeutils/internaltofrontend_test.go b/internal/typeutils/internaltofrontend_test.go index aeb7ea0b95..9128b58f6d 100644 --- a/internal/typeutils/internaltofrontend_test.go +++ b/internal/typeutils/internaltofrontend_test.go @@ -1429,6 +1429,8 @@ func (suite *InternalToFrontendTestSuite) TestInstanceV1ToFrontend() { "audio/mp2", "audio/mp3", "video/x-msvideo", + "audio/flac", + "audio/x-flac", "image/png", "image/apng", "audio/ogg", @@ -1567,6 +1569,8 @@ func (suite *InternalToFrontendTestSuite) TestInstanceV2ToFrontend() { "audio/mp2", "audio/mp3", "video/x-msvideo", + "audio/flac", + "audio/x-flac", "image/png", "image/apng", "audio/ogg",