feat: add transcodedSuffix to Subsonic API responses

This commit is contained in:
Deluan
2020-03-16 12:56:15 -04:00
committed by Deluan Quintão
parent 45180115a6
commit 39993810b3
12 changed files with 136 additions and 61 deletions
+4 -1
View File
@@ -103,11 +103,14 @@ func getPlayer(players engine.Players) func(next http.Handler) http.Handler {
client := ctx.Value("client").(string)
playerId := playerIDFromCookie(r, userName)
ip, _, _ := net.SplitHostPort(r.RemoteAddr)
player, err := players.Register(ctx, playerId, client, r.Header.Get("user-agent"), ip)
player, trc, err := players.Register(ctx, playerId, client, r.Header.Get("user-agent"), ip)
if err != nil {
log.Error("Could not register player", "userName", userName, "client", client)
} else {
ctx = context.WithValue(ctx, "player", *player)
if trc != nil {
ctx = context.WithValue(ctx, "transcoding", *trc)
}
r = r.WithContext(ctx)
}