Logs new stream sessions
This commit is contained in:
parent
a17a98a75f
commit
647132625c
2 changed files with 18 additions and 1 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
package engine
|
package engine
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
|
@ -153,3 +154,12 @@ func FromArtists(ars model.Artists) Entries {
|
||||||
}
|
}
|
||||||
return entries
|
return entries
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func userName(ctx context.Context) string {
|
||||||
|
user := ctx.Value("user")
|
||||||
|
if user == nil {
|
||||||
|
return "UNKNOWN"
|
||||||
|
}
|
||||||
|
usr := user.(model.User)
|
||||||
|
return usr.UserName
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,14 @@ func (ms *mediaStreamer) NewStream(ctx context.Context, id string, reqFormat str
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
format, bitRate := selectTranscodingOptions(ctx, ms.ds, mf, reqFormat, reqBitRate)
|
var format string
|
||||||
|
var bitRate int
|
||||||
|
defer func() {
|
||||||
|
log.Info("Streaming file", "title", mf.Title, "artist", mf.Artist, "format", format,
|
||||||
|
"bitRate", bitRate, "user", userName(ctx), "transcoding", format != "raw", "originalFormat", mf.Suffix)
|
||||||
|
}()
|
||||||
|
|
||||||
|
format, bitRate = selectTranscodingOptions(ctx, ms.ds, mf, reqFormat, reqBitRate)
|
||||||
log.Trace(ctx, "Selected transcoding options",
|
log.Trace(ctx, "Selected transcoding options",
|
||||||
"requestBitrate", reqBitRate, "requestFormat", reqFormat,
|
"requestBitrate", reqBitRate, "requestFormat", reqFormat,
|
||||||
"originalBitrate", mf.BitRate, "originalFormat", mf.Suffix,
|
"originalBitrate", mf.BitRate, "originalFormat", mf.Suffix,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue