spoty

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Module = fx.Options(
	fx.Provide(New),
)

Module exported for initialising a new Spoty service.

Functions

This section is empty.

Types

type Image

type Image struct {
	URL      string     `json:"url"`
	Height   int        `json:"height"`
	Width    int        `json:"width"`
	RGBA     color.RGBA `json:"rgba,omitempty"`
	Hex      string     `json:"hex,omitempty"`
	Error    string     `json:"error,omitempty"`
	RawError error      `json:"-"`
}

Image represents an image with its dominant color.

type Spoty

type Spoty struct {
	// contains filtered or unexported fields
}

Spoty represents the spoty service.

func New

func New(
	cfg *config.Config,
	logger *logger.Logger,
	tracer *tracer.Tracer,
	cache *cache.Cache,
	health *health.Checks,
) (*Spoty, error)

New creates a new spoty service.

func (*Spoty) AuthURL

func (s *Spoty) AuthURL() string

AuthURL returns the spotify auth url.

func (*Spoty) Check

func (s *Spoty) Check() health.Check

Check checks if the spoty service is authenticated.

func (*Spoty) IsAuth

func (s *Spoty) IsAuth() bool

IsAuth returns true if the client was created.

func (*Spoty) IsPlaying

func (s *Spoty) IsPlaying() bool

IsPlaying returns true if the client is currently playing.

func (*Spoty) SetupNewClient

func (s *Spoty) SetupNewClient(r *http.Request) error

SetupNewClient sets up a new spotify client.

func (*Spoty) TrackCurrentlyPlaying

func (s *Spoty) TrackCurrentlyPlaying(ctx context.Context) (*spotify.FullTrack, error)

TrackCurrentlyPlaying returns the currently playing track.

func (*Spoty) TrackImages

func (s *Spoty) TrackImages(ctx context.Context, track *spotify.FullTrack) ([]Image, error)

TrackImages returns the track images from a track.

Jump to

Keyboard shortcuts

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