service

package
v0.0.0-...-b7bd2ad Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2025 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AlbumDataFromSpotifyAlbum

func AlbumDataFromSpotifyAlbum(a spotify.FullAlbum) (*db.AlbumData, error)

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 CacheSpotifyAlbums

func CacheSpotifyAlbums(ctx context.Context, albumsToCache []*spotify.FullAlbum) error

func CacheSpotifyArtists

func CacheSpotifyArtists(ctx context.Context, artistsToCache []*spotify.FullArtist) error

func GetAlbum

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

func GetAlbum128Image

func GetAlbum128Image(a spotify.FullAlbum) *spotify.Image

func GetAlbum300Image

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

func GetAlbums

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

func GetArtist

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

func GetArtist128Image

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

func GetArtist300Image

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

func GetArtists

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

func GetArtistsForTrack

func GetArtistsForTrack(t spotify.FullTrack) []string

func GetSimpleAlbum128Image

func GetSimpleAlbum128Image(a spotify.SimpleAlbum) *spotify.Image

func GetSpotifyPlaylist128Image

func GetSpotifyPlaylist128Image(p spotify.SimplePlaylist) *spotify.Image

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 IDFromURIPtr

func IDFromURIPtr(uri *string) (*string, error)

func InsertParamsFromFullAlbums

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

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 QSPlaylist

type QSPlaylist struct {
	TrackCount int `json:"track_count"`
	// contains filtered or unexported fields
}

func QSPlaylistFromSpotify

func QSPlaylistFromSpotify(p spotify.SimplePlaylist) *QSPlaylist

type QSPlaylistWithTracks

type QSPlaylistWithTracks struct {
	Tracks []db.TrackData `json:"tracks"`
	// contains filtered or unexported fields
}

func QSPlaylistWithTracksFromSpotifyFull

func QSPlaylistWithTracksFromSpotifyFull(p spotify.FullPlaylist) *QSPlaylistWithTracks

type SimpleAlbumData

type SimpleAlbumData struct {
	ID                   string     `json:"id"`
	URI                  string     `json:"uri"`
	Name                 string     `json:"name"`
	ArtistID             string     `json:"artist_id"`
	ArtistURI            string     `json:"artist_uri"`
	ArtistName           string     `json:"artist_name"`
	AlbumGroup           *string    `json:"album_group"`
	AlbumType            *string    `json:"album_type"`
	ImageUrl             *string    `json:"image_url"`
	ReleaseDate          *time.Time `json:"release_date"`
	ReleaseDatePrecision *string    `json:"release_date_precision"`
}

func SearchAlbums

func SearchAlbums(ctx context.Context, spClient *spotify.Client, text string) ([]SimpleAlbumData, error)

func SimpleAlbumDataFromSimpleAlbum

func SimpleAlbumDataFromSimpleAlbum(a spotify.SimpleAlbum) (SimpleAlbumData, 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