service

package
v0.0.0-...-56a5168 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2024 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArtistDataFromFullArtist

func ArtistDataFromFullArtist(fa spotify.FullArtist) db.ArtistData

func ArtistDataFromFullArtistIdx

func ArtistDataFromFullArtistIdx(fa spotify.FullArtist, _ int) db.ArtistData

func CacheFullTracks

func CacheFullTracks(ctx context.Context, tx db.DBTX, tracks []*spotify.FullTrack)

func GetAlbum

func GetAlbum(ctx context.Context, spClient *spotify.Client, id string) (*spotify.FullAlbum, error)

func GetAlbum300Image

func GetAlbum300Image(t spotify.SimpleAlbum) *spotify.Image

func GetAlbumCache

func GetAlbumCache() map[string]spotify.FullAlbum

func GetAlbums

func GetAlbums(ctx context.Context, spClient *spotify.Client, ids []string) (map[string]spotify.FullAlbum, error)

func GetArtist

func GetArtist(ctx context.Context, spClient *spotify.Client, id string) (*spotify.FullArtist, error)

func GetArtist300Image

func GetArtist300Image(a spotify.FullArtist) *spotify.Image

func GetArtistCache

func GetArtistCache() map[string]spotify.FullArtist

func GetArtists

func GetArtists(ctx context.Context, spClient *spotify.Client, ids []string) (map[string]spotify.FullArtist, error)

func GetArtistsForTrack

func GetArtistsForTrack(t spotify.FullTrack) []string

func GetTrack

func GetTrack(ctx context.Context, spClient *spotify.Client, id string) (*db.TrackData, error)

func GetTracks

func GetTracks(ctx context.Context, spClient *spotify.Client, ids []string) (map[string]db.TrackData, error)

func GetTracksFromCache

func GetTracksFromCache(ctx context.Context, tx db.DBTX, ids []string) (map[string]db.TrackData, error)

func IDFromURI

func IDFromURI(uri string) (string, error)

func IDFromURIMust

func IDFromURIMust(uri string) string

func IDFromURIMustIdx

func IDFromURIMustIdx(uri string, _ int) string

func InsertParamsFromFullAlbums

func InsertParamsFromFullAlbums(albums []*spotify.FullAlbum) db.AlbumCacheInsertBulkNullableParams

func InsertParamsFromFullArtists

func InsertParamsFromFullArtists(artists []*spotify.FullArtist) db.ArtistCacheInsertBulkNullableParams

func InsertParamsFromFullTracks

func InsertParamsFromFullTracks(tracks []*spotify.FullTrack) db.TrackCacheInsertBulkNullableParams

func PushToUserQueue

func PushToUserQueue(ctx context.Context, client *spotify.Client, songID string) error

func SearchArtists

func SearchArtists(ctx context.Context, spClient *spotify.Client, text string) ([]db.ArtistData, error)

func SearchTracks

func SearchTracks(ctx context.Context, spClient *spotify.Client, text string) ([]db.TrackData, error)

func TrackDataFromFullTrack

func TrackDataFromFullTrack(ft spotify.FullTrack) db.TrackData

func TrackDataFromFullTrackIdx

func TrackDataFromFullTrackIdx(ft spotify.FullTrack, _ int) db.TrackData

func UpdateUserPlayback

func UpdateUserPlayback(ctx context.Context, client *spotify.Client, playbackStatus *CurrentQueue) error

Types

type CurrentQueue

type CurrentQueue struct {
	CurrentlyPlaying TrackInfo   `json:"currently_playing"`
	Queue            []TrackInfo `json:"queue"`
}

func GetUserQueue

func GetUserQueue(ctx context.Context, client *spotify.Client) (*CurrentQueue, error)

type SpotifyUser

type SpotifyUser struct {
	ID       string
	Display  string
	ImageURL string
}

func GetUser

func GetUser(ctx context.Context, client *spotify.Client) (*SpotifyUser, error)

type TrackArtist

type TrackArtist struct {
	ID   string `json:"id"`
	URI  string `json:"uri"`
	Name string `json:"name"`
}

type TrackData

type TrackData struct {
	ID           string                   `json:"id"`
	Uri          string                   `json:"uri"`
	Name         string                   `json:"name"`
	AlbumID      string                   `json:"album_id"`
	AlbumUri     string                   `json:"album_uri"`
	AlbumName    string                   `json:"album_name"`
	ArtistID     string                   `json:"artist_id"`
	ArtistUri    string                   `json:"artist_uri"`
	ArtistName   string                   `json:"artist_name"`
	ImageUrl     *string                  `json:"image_url"`
	OtherArtists TrackArtist              `json:"other_artists"`
	DurationMs   int32                    `json:"duration_ms"`
	Popularity   int32                    `json:"popularity"`
	Explicit     bool                     `json:"explicit"`
	PreviewUrl   string                   `json:"preview_url"`
	DiscNumber   int32                    `json:"disc_number"`
	TrackNumber  int32                    `json:"track_number"`
	Type         string                   `json:"type"`
	ExternalIds  spotify.TrackExternalIDs `json:"external_ids"`
	Isrc         *string                  `json:"isrc"`
}

type TrackInfo

type TrackInfo struct {
	ID                       string                 `json:"id"`
	Name                     string                 `json:"name"`
	Artists                  []spotify.SimpleArtist `json:"artists"`
	Image                    *spotify.Image         `json:"image"`
	AddedBy                  string                 `json:"added_by,omitempty"`
	AddedAt                  time.Time              `json:"-"`
	Paused                   bool                   `json:"paused"`
	DurationMS               int                    `json:"duration_ms,omitempty"`
	StartedPlayingEpochMilis *int64                 `json:"started_playing_epoch_ms,omitempty"`
}

func TopTracks

func TopTracks(ctx context.Context, spClient *spotify.Client) ([]TrackInfo, error)

Jump to

Keyboard shortcuts

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