docs(api): document intentional audioContentType divergence from subsonic
This commit is contained in:
@@ -107,6 +107,7 @@ func seedTrackWithFile(t *testing.T, pool *pgxpool.Pool, albumID, artistID pgtyp
|
|||||||
ArtistID: artistID,
|
ArtistID: artistID,
|
||||||
TrackNumber: &one,
|
TrackNumber: &one,
|
||||||
DiscNumber: nil,
|
DiscNumber: nil,
|
||||||
|
// DurationMs: arbitrary non-zero; tests don't assert on it.
|
||||||
DurationMs: int32(len(fileBody)),
|
DurationMs: int32(len(fileBody)),
|
||||||
FilePath: path,
|
FilePath: path,
|
||||||
FileSize: int64(len(fileBody)),
|
FileSize: int64(len(fileBody)),
|
||||||
|
|||||||
@@ -57,6 +57,12 @@ func resolveAlbumCoverPath(ctx context.Context, q *dbq.Queries, album dbq.Album)
|
|||||||
// ogg, opus, m4a, aac, wav) to a MIME type for the Content-Type header.
|
// ogg, opus, m4a, aac, wav) to a MIME type for the Content-Type header.
|
||||||
// Unknown formats fall back to octet-stream so the browser downloads them
|
// Unknown formats fall back to octet-stream so the browser downloads them
|
||||||
// rather than attempting to decode.
|
// rather than attempting to decode.
|
||||||
|
//
|
||||||
|
// Divergences from internal/subsonic/types.go's contentTypeForFormat are
|
||||||
|
// intentional: opus→audio/ogg (library .opus files are Ogg-encapsulated, so
|
||||||
|
// this matches real library contents), aac→audio/aac (raw AAC is ADTS, not
|
||||||
|
// MP4, so audio/mp4 would mislead codec sniffers), and there is no "oga" case
|
||||||
|
// (we don't record that format). Don't "fix" these to match subsonic.
|
||||||
func audioContentType(format string) string {
|
func audioContentType(format string) string {
|
||||||
switch strings.ToLower(format) {
|
switch strings.ToLower(format) {
|
||||||
case "mp3":
|
case "mp3":
|
||||||
|
|||||||
Reference in New Issue
Block a user