mirror of
https://github.com/taigrr/wtf
synced 2025-01-18 04:03:14 -08:00
WTF-400 Spotify extracted to new config format
This commit is contained in:
18
modules/spotify/settings.go
Normal file
18
modules/spotify/settings.go
Normal file
@@ -0,0 +1,18 @@
|
||||
package spotify
|
||||
|
||||
import (
|
||||
"github.com/olebedev/config"
|
||||
"github.com/wtfutil/wtf/cfg"
|
||||
)
|
||||
|
||||
type Settings struct {
|
||||
common *cfg.Common
|
||||
}
|
||||
|
||||
func NewSettingsFromYAML(ymlConfig *config.Config) *Settings {
|
||||
settings := Settings{
|
||||
common: cfg.NewCommonSettingsFromYAML(ymlConfig),
|
||||
}
|
||||
|
||||
return &settings
|
||||
}
|
||||
@@ -20,17 +20,21 @@ const HelpText = `
|
||||
type Widget struct {
|
||||
wtf.HelpfulWidget
|
||||
wtf.TextWidget
|
||||
spotigopher.SpotifyClient
|
||||
|
||||
settings *Settings
|
||||
spotigopher.Info
|
||||
spotigopher.SpotifyClient
|
||||
}
|
||||
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages) *Widget {
|
||||
func NewWidget(app *tview.Application, pages *tview.Pages, settings *Settings) *Widget {
|
||||
spotifyClient := spotigopher.NewClient()
|
||||
widget := Widget{
|
||||
HelpfulWidget: wtf.NewHelpfulWidget(app, pages, HelpText),
|
||||
TextWidget: wtf.NewTextWidget(app, "Spotify", "spotify", true),
|
||||
SpotifyClient: spotifyClient,
|
||||
|
||||
Info: spotigopher.Info{},
|
||||
SpotifyClient: spotifyClient,
|
||||
settings: settings,
|
||||
}
|
||||
widget.HelpfulWidget.SetView(widget.View)
|
||||
widget.TextWidget.RefreshInt = 5
|
||||
|
||||
Reference in New Issue
Block a user