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:
parent
0403b75fe8
commit
ae081e4b9f
9
main.go
9
main.go
@ -276,14 +276,15 @@ func makeWidget(app *tview.Application, pages *tview.Pages, widgetName string) w
|
||||
case "security":
|
||||
settings := security.NewSettingsFromYAML(wtf.Config)
|
||||
widget = security.NewWidget(app, settings)
|
||||
case "spotify":
|
||||
settings := spotify.NewSettingsFromYAML(wtf.Config)
|
||||
widget = spotify.NewWidget(app, pages, settings)
|
||||
case "spotifyweb":
|
||||
widget = spotifyweb.NewWidget(app, pages)
|
||||
case "status":
|
||||
widget = status.NewWidget(app)
|
||||
case "system":
|
||||
widget = system.NewWidget(app, date, version)
|
||||
case "spotify":
|
||||
widget = spotify.NewWidget(app, pages)
|
||||
case "spotifyweb":
|
||||
widget = spotifyweb.NewWidget(app, pages)
|
||||
case "textfile":
|
||||
widget = textfile.NewWidget(app, pages)
|
||||
case "todo":
|
||||
|
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user