listenbrainz

package
v0.0.0-...-ce70d39 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2024 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnexpectedResponseCode = errors.New("unexpected response code")
	ErrUnexpectedResponseBody = errors.New("unexpected response body")
	ErrUnauthenticated        = errors.New("unauthenticated")
	ErrNotEnoughMetadata      = errors.New("now enough metadata")
	ErrNotFound               = errors.New("not found")
)

Functions

This section is empty.

Types

type Connection

type Connection struct {
	User       string
	LBUsername string
	Token      string
}

type Feedback

type Feedback struct {
	SongID     string
	SongName   string
	SongMBID   *string
	AlbumName  *string
	ArtistName *string

	Score FeedbackScore
}

type FeedbackScore

type FeedbackScore int
const (
	FeedbackScoreLove FeedbackScore = 1
	FeedbackScoreNone FeedbackScore = 0
	FeedbackScoreHate FeedbackScore = -1
)

type Listen

type Listen struct {
	ListenedAt  time.Time
	SongName    string
	AlbumName   *string
	ArtistName  *string
	SongMBID    *string
	AlbumMBID   *string
	ReleaseMBID *string
	ArtistMBIDs []string
	TrackNumber *int
	DurationMS  *int
}

type ListenBrainz

type ListenBrainz struct {
	Store db.Store
	// contains filtered or unexported fields
}

func New

func New(store db.Store) *ListenBrainz

func (*ListenBrainz) CheckToken

func (l *ListenBrainz) CheckToken(ctx context.Context, token string) (Connection, error)

func (*ListenBrainz) Close

func (l *ListenBrainz) Close() error

func (*ListenBrainz) GetListenbrainzConnection

func (l *ListenBrainz) GetListenbrainzConnection(ctx context.Context, user string) (Connection, error)

func (*ListenBrainz) StartPeriodicSync

func (l *ListenBrainz) StartPeriodicSync(period time.Duration)

func (*ListenBrainz) SubmitImport

func (l *ListenBrainz) SubmitImport(ctx context.Context, con Connection, listens []*Listen, mediaPlayer string) error

func (*ListenBrainz) SubmitMissingListens

func (l *ListenBrainz) SubmitMissingListens(ctx context.Context) error

func (*ListenBrainz) SubmitPlayingNow

func (l *ListenBrainz) SubmitPlayingNow(ctx context.Context, con Connection, listen *Listen, mediaPlayer string) error

func (*ListenBrainz) SubmitSingle

func (l *ListenBrainz) SubmitSingle(ctx context.Context, con Connection, listen *Listen, mediaPlayer string) error

func (*ListenBrainz) SyncSongFeedback

func (l *ListenBrainz) SyncSongFeedback(ctx context.Context) error

func (*ListenBrainz) UpdateSongFeedback

func (l *ListenBrainz) UpdateSongFeedback(ctx context.Context, con Connection, feedback []*Feedback) (int, error)

Jump to

Keyboard shortcuts

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