Logs new stream sessions
This commit is contained in:
@@ -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,
|
||||||
|
|||||||
Reference in New Issue
Block a user