Add album listing to config ui so they can be selected / deselected
This commit is contained in:
parent
37bbc4658d
commit
a506546f1e
13
cmd/ui/ui.go
13
cmd/ui/ui.go
|
@ -24,7 +24,7 @@ const (
|
||||||
CMD_FINDMNT = "/usr/bin/findmnt"
|
CMD_FINDMNT = "/usr/bin/findmnt"
|
||||||
CMD_VCGENCMD = "/opt/vc/bin/vcgencmd"
|
CMD_VCGENCMD = "/opt/vc/bin/vcgencmd"
|
||||||
FILE_CPU_TEMP = "/sys/class/thermal/thermal_zone0/temp"
|
FILE_CPU_TEMP = "/sys/class/thermal/thermal_zone0/temp"
|
||||||
ALBUM_ROOT_DIR = "/tank/pictures"
|
ALBUM_ROOT_DIR = "/tank/pictures/"
|
||||||
SYNCTHING_FOLDER_SKIP = ".stfolder"
|
SYNCTHING_FOLDER_SKIP = ".stfolder"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -88,7 +88,11 @@ func main() {
|
||||||
if strings.Contains(path, SYNCTHING_FOLDER_SKIP) {
|
if strings.Contains(path, SYNCTHING_FOLDER_SKIP) {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
albums = append(albums, path)
|
albumName := strings.TrimPrefix(path, ALBUM_ROOT_DIR)
|
||||||
|
if albumName == "" {
|
||||||
|
albumName = "Main Folder"
|
||||||
|
}
|
||||||
|
albums = append(albums, albumName)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
@ -183,8 +187,9 @@ func main() {
|
||||||
|
|
||||||
// Select Albums Form
|
// Select Albums Form
|
||||||
selectAlbumsForm := tview.NewForm()
|
selectAlbumsForm := tview.NewForm()
|
||||||
selectAlbumsForm.AddCheckbox("Album 1", false, nil)
|
for _, album := range albums {
|
||||||
selectAlbumsForm.AddCheckbox("Album 2", false, nil)
|
selectAlbumsForm.AddCheckbox(album, true, nil)
|
||||||
|
}
|
||||||
selectAlbumsForm.AddButton("Apply", nil)
|
selectAlbumsForm.AddButton("Apply", nil)
|
||||||
selectAlbumsForm.AddButton("Cancel", func() {
|
selectAlbumsForm.AddButton("Cancel", func() {
|
||||||
main.Clear()
|
main.Clear()
|
||||||
|
|
Loading…
Reference in a new issue