navidrome/model/player.go
Deluan Quintão 6c11649b06
fix(insights): fix issues and improve reports (#3558)
* fix(insights): show error whn reading library counts

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(insights): wait 30 mins before send first report

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(insights): send number of active players, grouped by client type

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(insights): disable reports when running in dev mode

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(insights): add Dockerfile to the docker build, to avoid `vcs.modified=true`

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(insights): add more linux fs types

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(insights): need admin permissions to retrieve library counts

Signed-off-by: Deluan <deluan@navidrome.org>

* fix(insights): dev flag to disable player insights

Signed-off-by: Deluan <deluan@navidrome.org>

---------

Signed-off-by: Deluan <deluan@navidrome.org>
2024-12-18 20:37:35 -05:00

32 lines
1.1 KiB
Go

package model
import (
"time"
)
type Player struct {
Username string `structs:"-" json:"userName"`
ID string `structs:"id" json:"id"`
Name string `structs:"name" json:"name"`
UserAgent string `structs:"user_agent" json:"userAgent"`
UserId string `structs:"user_id" json:"userId"`
Client string `structs:"client" json:"client"`
IP string `structs:"ip" json:"ip"`
LastSeen time.Time `structs:"last_seen" json:"lastSeen"`
TranscodingId string `structs:"transcoding_id" json:"transcodingId"`
MaxBitRate int `structs:"max_bit_rate" json:"maxBitRate"`
ReportRealPath bool `structs:"report_real_path" json:"reportRealPath"`
ScrobbleEnabled bool `structs:"scrobble_enabled" json:"scrobbleEnabled"`
}
type Players []Player
type PlayerRepository interface {
Get(id string) (*Player, error)
FindMatch(userId, client, userAgent string) (*Player, error)
Put(p *Player) error
CountAll(...QueryOptions) (int64, error)
CountByClient(...QueryOptions) (map[string]int64, error)
// TODO: Add CountAll method. Useful at least for metrics.
}