Skip to content

Commit

Permalink
[feature] add flac support (#3121)
Browse files Browse the repository at this point in the history
* add flac support to the ffprobe format/stream -> filetype parser

* also add audio/flac for flac (not just x-flac)

* update tests

---------

Co-authored-by: tobi <[email protected]>
  • Loading branch information
NyaaaWhatsUpDoc and tsmethurst authored Jul 21, 2024
1 parent 027a93f commit c635080
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
12 changes: 12 additions & 0 deletions internal/api/client/instance/instancepatch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -893,6 +903,8 @@ func (suite *InstancePatchTestSuite) TestInstancePatch9() {
"audio/mp2",
"audio/mp3",
"video/x-msvideo",
"audio/flac",
"audio/x-flac",
"image/png",
"image/apng",
"audio/ogg",
Expand Down
2 changes: 2 additions & 0 deletions internal/media/ffmpeg.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
3 changes: 3 additions & 0 deletions internal/media/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ var SupportedMIMETypes = []string{

"video/x-msvideo", // .avi

"audio/flac", // .flac
"audio/x-flac", // .flac

// png types
"image/png", // .png
"image/apng", // .apng
Expand Down
4 changes: 4 additions & 0 deletions internal/typeutils/internaltofrontend_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1432,6 +1432,8 @@ func (suite *InternalToFrontendTestSuite) TestInstanceV1ToFrontend() {
"audio/mp2",
"audio/mp3",
"video/x-msvideo",
"audio/flac",
"audio/x-flac",
"image/png",
"image/apng",
"audio/ogg",
Expand Down Expand Up @@ -1570,6 +1572,8 @@ func (suite *InternalToFrontendTestSuite) TestInstanceV2ToFrontend() {
"audio/mp2",
"audio/mp3",
"video/x-msvideo",
"audio/flac",
"audio/x-flac",
"image/png",
"image/apng",
"audio/ogg",
Expand Down

0 comments on commit c635080

Please sign in to comment.