feat(subsonic): return transcoded mime and transcoded suffix in subsonic responses

fixes #106

* Added support to TranscodedContentType and TranscodedSuffix

* Make sure that we have a profile

* Fix linting

* Fixed use of NewTCTrackByFolder instead of NewTrackByTags in handlers_by_tags.go

simplify a bit
This commit is contained in:
dertasiu
2022-11-02 23:10:23 +01:00
committed by sentriz
parent 692ec68282
commit 6e6404af73
8 changed files with 137 additions and 46 deletions

View File

@@ -43,6 +43,18 @@ func streamGetTransPref(dbc *db.DB, userID int, client string) (*db.TranscodePre
return &pref, nil
}
func streamGetTransPrefProfile(dbc *db.DB, userID int, client string) (mime string, suffix string) {
pref, _ := streamGetTransPref(dbc, userID, client)
if pref == nil {
return "", ""
}
profile, ok := transcode.UserProfiles[pref.Profile]
if !ok {
return "", ""
}
return profile.MIME(), profile.Suffix()
}
var errUnknownMediaType = fmt.Errorf("media type is unknown")
// TODO: there is a mismatch between abs paths for podcasts and music. if they were the same, db.AudioFile