state

package
v0.0.0-...-d6f5fe4 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UpdateQueue

func UpdateQueue() tea.Cmd

Types

type CacheEntry

type CacheEntry struct {
	Tracks              []spotify.SimpleTrack
	NextPage            *spotify.PlaylistItemPage
	HasMore             bool
	TotalTracks         int
	OriginalTotalTracks int // Track the original total from Spotify
	FilteredCount       int // Track cumulative filtered items
}

type DevicesUpdatedMsg

type DevicesUpdatedMsg struct{}

type ErrorMsg

type ErrorMsg struct {
	Title   string
	Message string
}

type PlayerStateUpdatedMsg

type PlayerStateUpdatedMsg struct {
}

type PlaylistSelectedMsg

type PlaylistSelectedMsg struct {
	PlaylistID string
}

type PlaylistsUpdatedMsg

type PlaylistsUpdatedMsg struct {
}

type QueueManager

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

func (*QueueManager) Dequeue

func (q *QueueManager) Dequeue() (spotify.SimpleTrack, error)

func (*QueueManager) Enqueue

func (q *QueueManager) Enqueue(track spotify.SimpleTrack)

func (*QueueManager) IsEmpty

func (q *QueueManager) IsEmpty() bool

func (*QueueManager) List

func (q *QueueManager) List() []spotify.SimpleTrack

func (*QueueManager) Peek

func (q *QueueManager) Peek() (spotify.SimpleTrack, error)

func (*QueueManager) PopAt

func (q *QueueManager) PopAt(index int) (spotify.SimpleTrack, error)

func (*QueueManager) Size

func (q *QueueManager) Size() int

type QueueUpdatedMsg

type QueueUpdatedMsg struct{}

type RetryableOperation

type RetryableOperation func(ctx context.Context) error

type SearchResultsUpdatedMsg

type SearchResultsUpdatedMsg struct{}

type SpotifyState

type SpotifyState struct {
	Queue QueueManager
	// contains filtered or unexported fields
}

SpotifyState manages all Spotify-related state and API calls

func NewSpotifyState

func NewSpotifyState(client *spotify.Client) *SpotifyState

func (*SpotifyState) DecreaseVolume

func (s *SpotifyState) DecreaseVolume(ctx context.Context) tea.Cmd

DecreaseVolume decreases the volume by 10%

func (*SpotifyState) FetchAlbumTracks

func (s *SpotifyState) FetchAlbumTracks(ctx context.Context, albumId spotify.ID) tea.Cmd

func (*SpotifyState) FetchArtistTopTracks

func (s *SpotifyState) FetchArtistTopTracks(ctx context.Context, artistID spotify.ID, country string) tea.Cmd

FetchArtistTopTracks retrieves top tracks for an artist

func (*SpotifyState) FetchDevices

func (s *SpotifyState) FetchDevices(ctx context.Context) tea.Cmd

func (*SpotifyState) FetchNextTracksPage

func (s *SpotifyState) FetchNextTracksPage(ctx context.Context, sourceID spotify.ID, nextPage *spotify.PlaylistItemPage) tea.Cmd

func (*SpotifyState) FetchPlaybackState

func (s *SpotifyState) FetchPlaybackState(ctx context.Context) tea.Cmd

func (*SpotifyState) FetchPlaylistTracks

func (s *SpotifyState) FetchPlaylistTracks(ctx context.Context, playlistID spotify.ID) tea.Cmd

func (*SpotifyState) FetchPlaylists

func (s *SpotifyState) FetchPlaylists(ctx context.Context) tea.Cmd

func (*SpotifyState) FetchTopTracks

func (s *SpotifyState) FetchTopTracks(ctx context.Context, artistId spotify.ID) tea.Cmd

func (*SpotifyState) GetCacheStats

func (s *SpotifyState) GetCacheStats(sourceID spotify.ID) (loadedTracks, totalTracks, originalTotal, filteredCount int, hasMore bool)

GetCacheStats returns debug information about the cache entry

func (*SpotifyState) GetCachedTracks

func (s *SpotifyState) GetCachedTracks(sourceID spotify.ID) (*CacheEntry, bool)

func (*SpotifyState) GetDeviceState

func (s *SpotifyState) GetDeviceState() []spotify.PlayerDevice

func (*SpotifyState) GetOathToken

func (s *SpotifyState) GetOathToken() *oauth2.Token

func (*SpotifyState) GetPlayerState

func (s *SpotifyState) GetPlayerState() spotify.PlayerState

func (*SpotifyState) GetPlaylists

func (s *SpotifyState) GetPlaylists() []spotify.SimplePlaylist

func (*SpotifyState) GetSearchResultAlbums

func (s *SpotifyState) GetSearchResultAlbums() []spotify.SimpleAlbum

func (*SpotifyState) GetSearchResultArtists

func (s *SpotifyState) GetSearchResultArtists() []spotify.FullArtist

func (*SpotifyState) GetSearchResultPlaylists

func (s *SpotifyState) GetSearchResultPlaylists() []spotify.SimplePlaylist

func (*SpotifyState) GetSearchResultTracks

func (s *SpotifyState) GetSearchResultTracks() []spotify.FullTrack

func (*SpotifyState) GetSelectedID

func (s *SpotifyState) GetSelectedID() spotify.ID

func (*SpotifyState) GetTotalTracks

func (s *SpotifyState) GetTotalTracks(sourceID spotify.ID) int

func (*SpotifyState) GetTracks

func (s *SpotifyState) GetTracks() []spotify.SimpleTrack

func (*SpotifyState) HasMoreTracks

func (s *SpotifyState) HasMoreTracks(sourceID spotify.ID) bool

func (*SpotifyState) IncreaseVolume

func (s *SpotifyState) IncreaseVolume(ctx context.Context) tea.Cmd

IncreaseVolume increases the volume by 10%

func (*SpotifyState) Mute

func (s *SpotifyState) Mute(ctx context.Context) tea.Cmd

Mute toggles the mute state of the player

func (*SpotifyState) PausePlayback

func (s *SpotifyState) PausePlayback(ctx context.Context) tea.Cmd

func (*SpotifyState) PlayTrack

func (s *SpotifyState) PlayTrack(ctx context.Context, trackID spotify.ID) tea.Cmd

func (*SpotifyState) PreviousTrack

func (s *SpotifyState) PreviousTrack(ctx context.Context) tea.Cmd

This doesn't work as of right now either I need to manually keep state of prior songs or convert to the context autoplay approach

func (*SpotifyState) SearchEverything

func (s *SpotifyState) SearchEverything(ctx context.Context, query string) tea.Cmd

func (*SpotifyState) SelectDevice

func (s *SpotifyState) SelectDevice(ctx context.Context, deviceID spotify.ID) tea.Cmd

func (*SpotifyState) SelectPlaylist

func (s *SpotifyState) SelectPlaylist(playlistID string) tea.Cmd

func (*SpotifyState) SetSelectedID

func (s *SpotifyState) SetSelectedID(id spotify.ID)

func (*SpotifyState) StartPlayback

func (s *SpotifyState) StartPlayback(ctx context.Context) tea.Cmd

func (*SpotifyState) ToggleRepeatMode

func (s *SpotifyState) ToggleRepeatMode(ctx context.Context) tea.Cmd

func (*SpotifyState) ToggleShuffleMode

func (s *SpotifyState) ToggleShuffleMode(ctx context.Context) tea.Cmd

type TracksUpdatedMsg

type TracksUpdatedMsg struct {
	SourceID spotify.ID
	Tracks   []spotify.SimpleTrack
	NextPage *spotify.PlaylistItemPage
}

Jump to

Keyboard shortcuts

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