scrobbler

package
v0.52.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2024 License: GPL-3.0 Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotAuthorized = errors.New("not authorized")
	ErrRetryLater    = errors.New("retry later")
	ErrUnrecoverable = errors.New("unrecoverable")
)

Functions

func Register

func Register(name string, init Constructor)

Types

type Constructor

type Constructor func(ds model.DataStore) Scrobbler

type NowPlayingInfo

type NowPlayingInfo struct {
	MediaFile  model.MediaFile
	Start      time.Time
	Username   string
	PlayerId   string
	PlayerName string
}

type PlayTracker

type PlayTracker interface {
	NowPlaying(ctx context.Context, playerId string, playerName string, trackId string) error
	GetNowPlaying(ctx context.Context) ([]NowPlayingInfo, error)
	Submit(ctx context.Context, submissions []Submission) error
}

func GetPlayTracker

func GetPlayTracker(ds model.DataStore, broker events.Broker) PlayTracker

type Scrobble

type Scrobble struct {
	model.MediaFile
	TimeStamp time.Time
}

type Scrobbler

type Scrobbler interface {
	IsAuthorized(ctx context.Context, userId string) bool
	NowPlaying(ctx context.Context, userId string, track *model.MediaFile) error
	Scrobble(ctx context.Context, userId string, s Scrobble) error
}

type Submission

type Submission struct {
	TrackID   string
	Timestamp time.Time
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL