add some comments
This commit is contained in:
@@ -18,6 +18,9 @@ const (
|
||||
ReplayGainTrack = string(player.ReplayGainTrack)
|
||||
)
|
||||
|
||||
// A high-level Subsonic-aware playback backend.
|
||||
// Manages loading tracks into the Player queue,
|
||||
// sending callbacks on play time updates and track changes.
|
||||
type PlaybackManager struct {
|
||||
ctx context.Context
|
||||
cancelPollPos context.CancelFunc
|
||||
|
||||
@@ -85,10 +85,12 @@ func (s *ServerManager) Logout() {
|
||||
}
|
||||
}
|
||||
|
||||
// Sets a callback that is invoked when a server is connected to.
|
||||
func (s *ServerManager) OnServerConnected(cb func()) {
|
||||
s.onServerConnected = append(s.onServerConnected, cb)
|
||||
}
|
||||
|
||||
// Sets a callback that is invoked when the user logs out of a server.
|
||||
func (s *ServerManager) OnLogout(cb func()) {
|
||||
s.onLogout = append(s.onLogout, cb)
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
// A component to check for updates from the
|
||||
// Github releases/latest URL.
|
||||
type UpdateChecker struct {
|
||||
OnUpdatedVersionFound func()
|
||||
|
||||
@@ -26,6 +28,8 @@ func NewUpdateChecker(appVersionTag, latestReleaseURL string, lastCheckedTag *st
|
||||
}
|
||||
}
|
||||
|
||||
// Start automatically polling for updates in the background.
|
||||
// Quits when the given ctx's Done channel returns a value.
|
||||
func (u *UpdateChecker) Start(ctx context.Context, interval time.Duration) {
|
||||
go func() {
|
||||
u.checkForUpdate() // check once at startup
|
||||
|
||||
Reference in New Issue
Block a user