Add album listing to config ui so they can be selected / deselected

This commit is contained in:
KemoNine 2020-09-02 02:16:06 -04:00
parent 37bbc4658d
commit a506546f1e
1 changed files with 9 additions and 4 deletions

View File

@ -24,7 +24,7 @@ const (
CMD_FINDMNT = "/usr/bin/findmnt"
CMD_VCGENCMD = "/opt/vc/bin/vcgencmd"
FILE_CPU_TEMP = "/sys/class/thermal/thermal_zone0/temp"
ALBUM_ROOT_DIR = "/tank/pictures"
ALBUM_ROOT_DIR = "/tank/pictures/"
SYNCTHING_FOLDER_SKIP = ".stfolder"
)
@ -88,7 +88,11 @@ func main() {
if strings.Contains(path, SYNCTHING_FOLDER_SKIP) {
return nil
}
albums = append(albums, path)
albumName := strings.TrimPrefix(path, ALBUM_ROOT_DIR)
if albumName == "" {
albumName = "Main Folder"
}
albums = append(albums, albumName)
}
return nil
})
@ -183,8 +187,9 @@ func main() {
// Select Albums Form
selectAlbumsForm := tview.NewForm()
selectAlbumsForm.AddCheckbox("Album 1", false, nil)
selectAlbumsForm.AddCheckbox("Album 2", false, nil)
for _, album := range albums {
selectAlbumsForm.AddCheckbox(album, true, nil)
}
selectAlbumsForm.AddButton("Apply", nil)
selectAlbumsForm.AddButton("Cancel", func() {
main.Clear()