diff options
author | Simon Garrelou <simon.garrelou@gmail.com> | 2022-12-11 20:54:33 +0100 |
---|---|---|
committer | Simon Garrelou <simon.garrelou@gmail.com> | 2022-12-11 20:54:33 +0100 |
commit | c27a2911eff2ffaa50977f9365ae0736e3b76b8a (patch) | |
tree | 9898d8571c5593d63061516025c2f1991ed36f33 /src/page_config.go | |
parent | f4aa3110214513afbba43b2d1d483dc201d70e00 (diff) | |
download | termsonic-c27a2911eff2ffaa50977f9365ae0736e3b76b8a.tar.gz termsonic-c27a2911eff2ffaa50977f9365ae0736e3b76b8a.zip |
Add "Refresh" in config page
Diffstat (limited to 'src/page_config.go')
-rw-r--r-- | src/page_config.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/page_config.go b/src/page_config.go index 71662ec..2f8a27b 100644 --- a/src/page_config.go +++ b/src/page_config.go | |||
@@ -5,6 +5,7 @@ import ( | |||
5 | "net/http" | 5 | "net/http" |
6 | 6 | ||
7 | "github.com/delucks/go-subsonic" | 7 | "github.com/delucks/go-subsonic" |
8 | "github.com/gdamore/tcell/v2" | ||
8 | "github.com/rivo/tview" | 9 | "github.com/rivo/tview" |
9 | ) | 10 | ) |
10 | 11 | ||
@@ -36,6 +37,25 @@ func (a *app) configPage() *tview.Form { | |||
36 | a.alert("All good!") | 37 | a.alert("All good!") |
37 | } | 38 | } |
38 | }) | 39 | }) |
40 | |||
41 | form.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey { | ||
42 | if event.Rune() == 'R' { | ||
43 | if err := a.refreshArtists(); err != nil { | ||
44 | a.alert("Error: %v", err) | ||
45 | return nil | ||
46 | } | ||
47 | |||
48 | if err := a.refreshPlaylists(); err != nil { | ||
49 | a.alert("Error: %v", err) | ||
50 | return nil | ||
51 | } | ||
52 | |||
53 | a.alert("Refreshed successfully") | ||
54 | } | ||
55 | |||
56 | return nil | ||
57 | }) | ||
58 | |||
39 | return form | 59 | return form |
40 | } | 60 | } |
41 | 61 | ||