mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-30 22:22:25 -05:00 
			
		
		
		
	[feature] add flac support (#3121)
* 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 <tobi.smethurst@protonmail.com>
This commit is contained in:
		
					parent
					
						
							
								027a93facc
							
						
					
				
			
			
				commit
				
					
						c635080a0b
					
				
			
		
					 4 changed files with 21 additions and 0 deletions
				
			
		|  | @ -109,6 +109,8 @@ func (suite *InstancePatchTestSuite) TestInstancePatch1() { | ||||||
|         "audio/mp2", |         "audio/mp2", | ||||||
|         "audio/mp3", |         "audio/mp3", | ||||||
|         "video/x-msvideo", |         "video/x-msvideo", | ||||||
|  |         "audio/flac", | ||||||
|  |         "audio/x-flac", | ||||||
|         "image/png", |         "image/png", | ||||||
|         "image/apng", |         "image/apng", | ||||||
|         "audio/ogg", |         "audio/ogg", | ||||||
|  | @ -243,6 +245,8 @@ func (suite *InstancePatchTestSuite) TestInstancePatch2() { | ||||||
|         "audio/mp2", |         "audio/mp2", | ||||||
|         "audio/mp3", |         "audio/mp3", | ||||||
|         "video/x-msvideo", |         "video/x-msvideo", | ||||||
|  |         "audio/flac", | ||||||
|  |         "audio/x-flac", | ||||||
|         "image/png", |         "image/png", | ||||||
|         "image/apng", |         "image/apng", | ||||||
|         "audio/ogg", |         "audio/ogg", | ||||||
|  | @ -377,6 +381,8 @@ func (suite *InstancePatchTestSuite) TestInstancePatch3() { | ||||||
|         "audio/mp2", |         "audio/mp2", | ||||||
|         "audio/mp3", |         "audio/mp3", | ||||||
|         "video/x-msvideo", |         "video/x-msvideo", | ||||||
|  |         "audio/flac", | ||||||
|  |         "audio/x-flac", | ||||||
|         "image/png", |         "image/png", | ||||||
|         "image/apng", |         "image/apng", | ||||||
|         "audio/ogg", |         "audio/ogg", | ||||||
|  | @ -562,6 +568,8 @@ func (suite *InstancePatchTestSuite) TestInstancePatch6() { | ||||||
|         "audio/mp2", |         "audio/mp2", | ||||||
|         "audio/mp3", |         "audio/mp3", | ||||||
|         "video/x-msvideo", |         "video/x-msvideo", | ||||||
|  |         "audio/flac", | ||||||
|  |         "audio/x-flac", | ||||||
|         "image/png", |         "image/png", | ||||||
|         "image/apng", |         "image/apng", | ||||||
|         "audio/ogg", |         "audio/ogg", | ||||||
|  | @ -718,6 +726,8 @@ func (suite *InstancePatchTestSuite) TestInstancePatch8() { | ||||||
|         "audio/mp2", |         "audio/mp2", | ||||||
|         "audio/mp3", |         "audio/mp3", | ||||||
|         "video/x-msvideo", |         "video/x-msvideo", | ||||||
|  |         "audio/flac", | ||||||
|  |         "audio/x-flac", | ||||||
|         "image/png", |         "image/png", | ||||||
|         "image/apng", |         "image/apng", | ||||||
|         "audio/ogg", |         "audio/ogg", | ||||||
|  | @ -893,6 +903,8 @@ func (suite *InstancePatchTestSuite) TestInstancePatch9() { | ||||||
|         "audio/mp2", |         "audio/mp2", | ||||||
|         "audio/mp3", |         "audio/mp3", | ||||||
|         "video/x-msvideo", |         "video/x-msvideo", | ||||||
|  |         "audio/flac", | ||||||
|  |         "audio/x-flac", | ||||||
|         "image/png", |         "image/png", | ||||||
|         "image/apng", |         "image/apng", | ||||||
|         "audio/ogg", |         "audio/ogg", | ||||||
|  |  | ||||||
|  | @ -335,6 +335,8 @@ func (res *result) GetFileType() (gtsmodel.FileType, string) { | ||||||
| 		} | 		} | ||||||
| 	case "avi": | 	case "avi": | ||||||
| 		return gtsmodel.FileTypeVideo, "avi" | 		return gtsmodel.FileTypeVideo, "avi" | ||||||
|  | 	case "flac": | ||||||
|  | 		return gtsmodel.FileTypeAudio, "flac" | ||||||
| 	} | 	} | ||||||
| 	return gtsmodel.FileTypeUnknown, res.format | 	return gtsmodel.FileTypeUnknown, res.format | ||||||
| } | } | ||||||
|  |  | ||||||
|  | @ -43,6 +43,9 @@ var SupportedMIMETypes = []string{ | ||||||
| 
 | 
 | ||||||
| 	"video/x-msvideo", // .avi | 	"video/x-msvideo", // .avi | ||||||
| 
 | 
 | ||||||
|  | 	"audio/flac",   // .flac | ||||||
|  | 	"audio/x-flac", // .flac | ||||||
|  | 
 | ||||||
| 	// png types | 	// png types | ||||||
| 	"image/png",  // .png | 	"image/png",  // .png | ||||||
| 	"image/apng", // .apng | 	"image/apng", // .apng | ||||||
|  |  | ||||||
|  | @ -1432,6 +1432,8 @@ func (suite *InternalToFrontendTestSuite) TestInstanceV1ToFrontend() { | ||||||
|         "audio/mp2", |         "audio/mp2", | ||||||
|         "audio/mp3", |         "audio/mp3", | ||||||
|         "video/x-msvideo", |         "video/x-msvideo", | ||||||
|  |         "audio/flac", | ||||||
|  |         "audio/x-flac", | ||||||
|         "image/png", |         "image/png", | ||||||
|         "image/apng", |         "image/apng", | ||||||
|         "audio/ogg", |         "audio/ogg", | ||||||
|  | @ -1570,6 +1572,8 @@ func (suite *InternalToFrontendTestSuite) TestInstanceV2ToFrontend() { | ||||||
|         "audio/mp2", |         "audio/mp2", | ||||||
|         "audio/mp3", |         "audio/mp3", | ||||||
|         "video/x-msvideo", |         "video/x-msvideo", | ||||||
|  |         "audio/flac", | ||||||
|  |         "audio/x-flac", | ||||||
|         "image/png", |         "image/png", | ||||||
|         "image/apng", |         "image/apng", | ||||||
|         "audio/ogg", |         "audio/ogg", | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue