mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
Add ability to explicitly stop modules via a QuitChan
This commit is contained in:
@@ -18,19 +18,19 @@ func (widget *Widget) initializeKeyboardControls() {
|
||||
}
|
||||
|
||||
func (widget *Widget) previous() {
|
||||
widget.SpotifyClient.Previous()
|
||||
widget.client.Previous()
|
||||
time.Sleep(time.Second * 1)
|
||||
widget.Refresh()
|
||||
}
|
||||
|
||||
func (widget *Widget) next() {
|
||||
widget.SpotifyClient.Next()
|
||||
widget.client.Next()
|
||||
time.Sleep(time.Second * 1)
|
||||
widget.Refresh()
|
||||
}
|
||||
|
||||
func (widget *Widget) playPause() {
|
||||
widget.SpotifyClient.PlayPause()
|
||||
widget.client.PlayPause()
|
||||
time.Sleep(time.Second * 1)
|
||||
widget.Refresh()
|
||||
}
|
||||
|
||||
@@ -13,20 +13,19 @@ type Widget struct {
|
||||
wtf.KeyboardWidget
|
||||
wtf.TextWidget
|
||||
|
||||
client spotigopher.SpotifyClient
|
||||
settings *Settings
|
||||
spotigopher.Info
|
||||
spotigopher.SpotifyClient
|
||||
}
|
||||
|
||||
// NewWidget creates a new instance of a widget
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
spotifyClient := spotigopher.NewClient()
|
||||
widget := Widget{
|
||||
KeyboardWidget: wtf.NewKeyboardWidget(app, pages, settings.common),
|
||||
TextWidget: wtf.NewTextWidget(app, settings.common, true),
|
||||
|
||||
Info: spotigopher.Info{},
|
||||
SpotifyClient: spotifyClient,
|
||||
Info: spotigopher.Info{},
|
||||
client: spotigopher.NewClient(),
|
||||
|
||||
settings: settings,
|
||||
}
|
||||
@@ -45,7 +44,7 @@ func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *
|
||||
}
|
||||
|
||||
func (w *Widget) refreshSpotifyInfos() error {
|
||||
info, err := w.SpotifyClient.GetInfo()
|
||||
info, err := w.client.GetInfo()
|
||||
w.Info = info
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user