Documentation
¶
Index ¶
- Constants
- func DeleteCredentials()
- func LoadCredentials(cfg *backend.Config)
- func PlayList(p PlayerPort, l *List, index int)
- func Registration() pluginapi.Registration
- func SaveCredentials(cfg backend.Config) error
- func ShuffleList(ctx context.Context, p PlayerPort, l *List, post func(func()))
- func Start(start pluginapi.Startup) pluginapi.Adapter
- type AccountAction
- type Adapter
- type CardView
- type Catalog
- func (c *Catalog) AlbumsList() *paging.Pager[pluginapi.Playlist]
- func (c *Catalog) ArtistAlbumsList(id int64, ref string) *paging.Pager[pluginapi.Playlist]
- func (c *Catalog) ArtistsList() *paging.Pager[pluginapi.Playlist]
- func (c *Catalog) FavoriteChanged(id int64, liked bool)
- func (c *Catalog) GenresList() *paging.Pager[pluginapi.Playlist]
- func (c *Catalog) ListFor(id int64) *List
- func (c *Catalog) ListForRoute(id int64, kind, ref string) *List
- func (c *Catalog) NewList(spec Spec) *List
- func (c *Catalog) Refresh(id int64)
- func (c *Catalog) RemoveFavorite(id int64) bool
- func (c *Catalog) Search(query string) error
- type Home
- func (h *Home) Back()
- func (h *Home) CanBack() bool
- func (h *Home) CanForward() bool
- func (h *Home) CloseTransient()
- func (h *Home) Content(c *ui.Context)
- func (h *Home) Forward()
- func (h *Home) Open(route Route)
- func (h *Home) ReportStarted(tr *pluginapi.Track)
- func (h *Home) RequestAddList(pl pluginapi.Playlist, l *List)
- func (h *Home) RequestAddTracks(pl pluginapi.Playlist, tracks []pluginapi.Track)
- func (h *Home) RequestChangeCover(pl pluginapi.Playlist)
- func (h *Home) RequestDelete(pl pluginapi.Playlist)
- func (h *Home) RequestFavorite(tr pluginapi.Track, liked bool)
- func (h *Home) RequestNewPlaylist(tracks []pluginapi.Track)
- func (h *Home) RequestNewPlaylistFrom(l *List)
- func (h *Home) RequestRemoveTrack(pl pluginapi.Playlist, tr pluginapi.Track)
- func (h *Home) RequestRename(pl pluginapi.Playlist)
- func (h *Home) ResetNavigation(route Route)
- func (h *Home) Route() Route
- func (h *Home) SearchText() *string
- func (h *Home) Settings(c *ui.Context)
- func (h *Home) State() *State
- type Host
- type List
- type ListKind
- type Page
- type PlayerPort
- type Route
- type RuntimeAdapter
- func (r *RuntimeAdapter) Cancel(context.Context) error
- func (r *RuntimeAdapter) Config() connectionConfig
- func (r *RuntimeAdapter) Configured() bool
- func (r *RuntimeAdapter) Connect(ctx context.Context, cfg connectionConfig) error
- func (r *RuntimeAdapter) Connected() bool
- func (r *RuntimeAdapter) Disconnect(ctx context.Context) error
- func (r *RuntimeAdapter) Error() error
- func (r *RuntimeAdapter) FetchArtwork(ctx context.Context, raw string, size int) ([]byte, bool, error)
- func (r *RuntimeAdapter) SetConfig(cfg connectionConfig)
- func (r *RuntimeAdapter) SetSort(key, value string)
- func (r *RuntimeAdapter) SetTranscode(v transcodeSettings)
- func (r *RuntimeAdapter) Sorts() map[string]string
- func (r *RuntimeAdapter) Transcode() transcodeSettings
- func (r *RuntimeAdapter) TranscodeBitrates() []int
- type SearchResults
- type SearchView
- type Spec
- type State
- func (s *State) AddToPlaylist(ctx context.Context, pl pluginapi.Playlist, tracks []pluginapi.Track) error
- func (s *State) Attach(client *backend.Client) error
- func (s *State) Cancel()
- func (s *State) Catalog() *Catalog
- func (s *State) ChangePlaylistCover(ctx context.Context, pl pluginapi.Playlist, picture []byte) (string, error)
- func (s *State) CheckContext(ctx context.Context) error
- func (s *State) Client() *backend.Client
- func (s *State) Config() backend.Config
- func (s *State) Connected() bool
- func (s *State) Connecting() bool
- func (s *State) CreatePlaylist(ctx context.Context, name string) (pluginapi.Playlist, error)
- func (s *State) DeletePlaylist(ctx context.Context, pl pluginapi.Playlist) error
- func (s *State) Detach() *backend.Client
- func (s *State) Error() error
- func (s *State) FetchArtwork(ctx context.Context, raw string, size int) (data []byte, handled bool, err error)
- func (s *State) FolderViewEnabled() bool
- func (s *State) Generation() uint64
- func (s *State) LikeBusy(id int64) bool
- func (s *State) Liked(id int64) bool
- func (s *State) LikedTrack(tr *pluginapi.Track) bool
- func (s *State) LoadPlaylists(ctx context.Context) ([]pluginapi.Playlist, error)
- func (s *State) NextRoam(ctx context.Context) (pluginapi.Track, error)
- func (s *State) Playlist(id int64) (pluginapi.Playlist, bool)
- func (s *State) Playlists() []pluginapi.Playlist
- func (s *State) Provider() *backend.Provider
- func (s *State) RemoveFromHistory(ctx context.Context, tr pluginapi.Track) error
- func (s *State) RemoveFromPlaylist(ctx context.Context, pl pluginapi.Playlist, tr pluginapi.Track) error
- func (s *State) RenamePlaylist(ctx context.Context, pl pluginapi.Playlist, name string) error
- func (s *State) ReportPlay(ctx context.Context, tr *pluginapi.Track) error
- func (s *State) RoamID() string
- func (s *State) SetConfig(cfg backend.Config)
- func (s *State) SetError(err error)
- func (s *State) SetFavorite(ctx context.Context, tr *pluginapi.Track, liked bool) error
- func (s *State) SetLiked(id int64, liked bool)
- func (s *State) SetPlaylists(lists []pluginapi.Playlist)
- func (s *State) SetPost(post func(func()))
- func (s *State) SetRoamID(id string)
- func (s *State) StartRoam(ctx context.Context) (pluginapi.Track, error)
- type TrackView
Constants ¶
const ( PageSize = 100 PageAhead = 2 CardsPage = 60 )
const ID = backend.PlatformID
Variables ¶
This section is empty.
Functions ¶
func DeleteCredentials ¶
func DeleteCredentials()
func LoadCredentials ¶
func PlayList ¶
func PlayList(p PlayerPort, l *List, index int)
func Registration ¶
func Registration() pluginapi.Registration
func SaveCredentials ¶
func ShuffleList ¶
func ShuffleList(ctx context.Context, p PlayerPort, l *List, post func(func()))
ShuffleList starts immediately when the first page is available. The page already displayed is always part of the first batch, so pressing shuffle never discards the list the user is looking at.
Types ¶
type AccountAction ¶
type Adapter ¶
type Adapter struct {
// contains filtered or unexported fields
}
Adapter owns one complete Feiniu context. The root app stores only this interface, so provider state and UI do not leak into shared app files.
func NewAdapter ¶
func (*Adapter) Configured ¶
func (*Adapter) FetchArtwork ¶
func (*Adapter) PlaybackMedia ¶
func (a *Adapter) PlaybackMedia() pluginapi.PlaybackMedia
type CardView ¶
type CardView struct {
Title string
Sub string
Count int
Header func(*ui.Context)
HeaderSkeleton func(*ui.Context)
OnOpen func(int64)
OnPlay func(int64)
// Meta reserves the card's secondary line in its loading skeleton.
Meta bool
// Round draws an artist's round photo over the name, with no play.
Round bool
Placeholder *ui.SVG
Art func(*ui.Painter, ui.Rect, *pluginapi.Playlist, float32)
}
type Catalog ¶
type Catalog struct {
Session *State
Post func(func())
OnTracks func([]pluginapi.Track)
Lists map[int64]*List
Meta map[int64]pluginapi.Playlist
SearchList *List
SearchAlbums, SearchArtists *paging.Pager[pluginapi.Playlist]
Albums, Artists, Genres *paging.Pager[pluginapi.Playlist]
ArtistAlbums map[int64]*paging.Pager[pluginapi.Playlist]
LibrarySort, FavoriteSort, AlbumSort, AlbumDetailSort string
ArtistSort, ArtistTrackSort, ArtistAlbumSort string
GenreSort, GenreTrackSort string
// contains filtered or unexported fields
}
Catalog owns list and card state for one Feiniu session.
func NewCatalog ¶
NewCatalog creates empty platform catalog state.
func (*Catalog) ArtistAlbumsList ¶
ArtistAlbumsList is the albums of one artist, in the order of ArtistAlbumSort.
func (*Catalog) FavoriteChanged ¶
FavoriteChanged drops or updates the cached favorites list after a successful like change.
func (*Catalog) GenresList ¶
GenresList is the style cards, in the order of GenreSort.
func (*Catalog) ListForRoute ¶
ListForRoute resolves a card using the provider-neutral route metadata. Cards carry a stable app ID for rendering, while Ref preserves the service identifier needed when the card's metadata has not reached Catalog.Meta yet (for example immediately after a reconnect).
func (*Catalog) RemoveFavorite ¶
RemoveFavorite takes a song out of the loaded favorites list without refetching every page.
type Home ¶
type Home struct {
// contains filtered or unexported fields
}
Home owns the Feiniu navigation and page selection. It deliberately does not know the root app's route type or render implementation.
func (*Home) CanForward ¶
func (*Home) CloseTransient ¶
func (h *Home) CloseTransient()
func (*Home) ReportStarted ¶
func (*Home) RequestAddTracks ¶
func (*Home) RequestChangeCover ¶
func (*Home) RequestDelete ¶
func (*Home) RequestNewPlaylist ¶
func (*Home) RequestNewPlaylistFrom ¶
func (*Home) RequestRemoveTrack ¶
func (*Home) RequestRename ¶
func (*Home) ResetNavigation ¶
ResetNavigation selects a platform page without carrying navigation from a previous connection or platform session.
func (*Home) SearchText ¶
type Host ¶
type Host = appplatform.Services
Host provides the desktop and playback services used by the plugin.
type List ¶
type List struct {
ID int64
Spec Spec
Kind string
HeaderKind string
Name string
Sub string
CoverURL string
Pages *paging.Pager[pluginapi.Track]
// contains filtered or unexported fields
}
List is a lazily loaded Feiniu catalog. Its pager is platform state, not UI state, so a view can be rebuilt without losing loaded pages.
type ListKind ¶
type ListKind string
ListKind describes a Feiniu catalog at the data layer. It does not select a UI; the platform home chooses how to present each list.
type Page ¶
type Page = string
Page identifies a route owned by a platform UI. The root app translates it to its shared route type; the platform package never imports that type.
const ( PageLibrary Page = "library" PageSearch Page = "search" PageSearchAlbums Page = "search-albums" PageSearchArtists Page = "search-artists" PageAlbums Page = "albums" PageArtists Page = "artists" PageArtistAlbums Page = "artist-albums" PagePlaylist Page = "playlist" PageRoam Page = "roam" PageFolders Page = "folders" PageGenres Page = "genres" )
type PlayerPort ¶
type PlayerPort = appplatform.PlayerPort
PlayerPort is the shared playback seam used by platform queue actions. The concrete player remains in the root app.
type Route ¶
Route is the small navigation value exchanged between a platform view and the root app. It deliberately contains no UI elements or app internals.
func ArtistSongsRoute ¶
func FavoritesRoute ¶
func FavoritesRoute() Route
type RuntimeAdapter ¶
type RuntimeAdapter struct {
// contains filtered or unexported fields
}
RuntimeAdapter translates the generic application seam into Feiniu's protocol configuration and lifecycle. No Feiniu client type escapes this package.
func NewRuntime ¶
func NewRuntime(state *State, settings *platformPreferences, save ...func()) *RuntimeAdapter
func (*RuntimeAdapter) Config ¶
func (r *RuntimeAdapter) Config() connectionConfig
func (*RuntimeAdapter) Configured ¶
func (r *RuntimeAdapter) Configured() bool
func (*RuntimeAdapter) Connect ¶
func (r *RuntimeAdapter) Connect(ctx context.Context, cfg connectionConfig) error
func (*RuntimeAdapter) Connected ¶
func (r *RuntimeAdapter) Connected() bool
func (*RuntimeAdapter) Disconnect ¶
func (r *RuntimeAdapter) Disconnect(ctx context.Context) error
func (*RuntimeAdapter) Error ¶
func (r *RuntimeAdapter) Error() error
func (*RuntimeAdapter) FetchArtwork ¶
func (*RuntimeAdapter) SetConfig ¶
func (r *RuntimeAdapter) SetConfig(cfg connectionConfig)
func (*RuntimeAdapter) SetSort ¶
func (r *RuntimeAdapter) SetSort(key, value string)
func (*RuntimeAdapter) SetTranscode ¶
func (r *RuntimeAdapter) SetTranscode(v transcodeSettings)
func (*RuntimeAdapter) Sorts ¶
func (r *RuntimeAdapter) Sorts() map[string]string
func (*RuntimeAdapter) Transcode ¶
func (r *RuntimeAdapter) Transcode() transcodeSettings
func (*RuntimeAdapter) TranscodeBitrates ¶
func (r *RuntimeAdapter) TranscodeBitrates() []int
type SearchResults ¶
type SearchView ¶
type State ¶
type State struct {
// contains filtered or unexported fields
}
State is the part of a Feiniu session that belongs to the platform. It is deliberately independent of windows, routes, MyGo UI elements and the shared player; the root app supplies those through a Host when rendering.
func (*State) AddToPlaylist ¶
func (*State) Attach ¶
Attach makes client the active session. It does not connect or log in; the caller controls that lifecycle and can publish the result through Host.
func (*State) Cancel ¶
func (s *State) Cancel()
Cancel invalidates in-flight platform work without logging out the active client. The owner uses it when switching away from this platform.
func (*State) ChangePlaylistCover ¶
func (*State) CheckContext ¶
CheckContext lets asynchronous platform jobs reject stale or canceled work before invoking a backend operation.
func (*State) Connecting ¶
Connecting reports an automatic or manual login that has not published its final catalog state yet. The home uses this to keep a loading surface up instead of flashing the connection form.
func (*State) CreatePlaylist ¶
CreatePlaylist creates a playlist and publishes it in account state.
func (*State) DeletePlaylist ¶
func (*State) Detach ¶
Detach clears the active session and returns its client for logout. The platform state is reset together, so a later login cannot see stale lists.
func (*State) FetchArtwork ¶
func (s *State) FetchArtwork(ctx context.Context, raw string, size int) (data []byte, handled bool, err error)
FetchArtwork handles only resources owned by this platform. Returning handled=false lets the shared app keep its normal NetEase fetch path without knowing platform URL schemes.
func (*State) FolderViewEnabled ¶
FolderViewEnabled reports the server capability after a successful connection. Unknown capabilities are treated as unavailable so older Feiniu Music versions do not expose a broken route.
func (*State) Generation ¶
Generation identifies the current connection session. UI actions capture it before starting asynchronous work and ignore completions after a reconnect, disconnect or platform switch.
func (*State) LikedTrack ¶
LikedTrack reports the optimistic liked state for a provider track.
func (*State) LoadPlaylists ¶
LoadPlaylists reads the account playlists through the platform provider and stores a private copy in the session.
func (*State) Playlist ¶
Playlist returns a copy of an account playlist. Copies keep callers from mutating session state while a request is in flight.
func (*State) RemoveFromHistory ¶
RemoveFromHistory removes one entry from the server play history and keeps the operation tied to the session that issued it.
func (*State) RemoveFromPlaylist ¶
func (*State) RenamePlaylist ¶
func (*State) ReportPlay ¶
ReportPlay records a started track in the service's play history.
func (*State) SetError ¶
SetError records an account or connection error without coupling the platform package to the root app's toast and error presentation.
func (*State) SetFavorite ¶
SetFavorite updates the optimistic state and persists the change through the platform backend. A failed request rolls the optimistic state back.
func (*State) SetPlaylists ¶
SetPlaylists replaces the account playlists with a copy owned by State.
func (*State) SetPost ¶
func (s *State) SetPost(post func(func()))
SetPost supplies the owner goroutine used by catalog page completions.
Source Files
¶
- account.go
- adapter.go
- backdrop.go
- card_view.go
- cards_page.go
- cast.go
- catalog.go
- connection.go
- cover.go
- credentials.go
- desktop_lyrics.go
- equalizer.go
- folder_actions.go
- folder_page.go
- folders.go
- genre_art.go
- genre_pattern.go
- genre_scenes.go
- genres.go
- home.go
- host.go
- icons.go
- like_view.go
- list_page.go
- main_window.go
- menu.go
- navigation.go
- nowplaying.go
- page_layout.go
- page_skeleton.go
- player.go
- playlist_edit.go
- playlist_menu.go
- preferences.go
- queue.go
- quick_player.go
- roam_page.go
- root_names.go
- runtime.go
- search_view.go
- session.go
- settings.go
- settings_view.go
- sidebar_view.go
- sorts.go
- sorts_state.go
- stage.go
- stage_styles.go
- state.go
- track_view.go
- view_options.go
- wall.go
- widgets.go
- window.go