Backend: Added 'ignore_folder' inside the photo path.
This commit is contained in:
parent
3a6213d412
commit
0d1e9dfee8
3 changed files with 14 additions and 2 deletions
|
@ -43,7 +43,7 @@ func listFiles(path string, actualdir string, picd []PictureData) []PictureData
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if info.IsDir() {
|
if info.IsDir() && !util.StringInSlice(info.Name(), util.GetConfig().IgnoreFolder) {
|
||||||
// fmt.Printf("\uf07b %s\n", entry.Name())
|
// fmt.Printf("\uf07b %s\n", entry.Name())
|
||||||
picd = listFiles(path+"/"+info.Name(), info.Name(), picd)
|
picd = listFiles(path+"/"+info.Name(), info.Name(), picd)
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -8,11 +8,13 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type ConfigJSON struct {
|
type ConfigJSON struct {
|
||||||
PhotoPath string
|
PhotoPath string `json:"photo_path"`
|
||||||
|
IgnoreFolder []string `json:"ignore_folder"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Config struct {
|
type Config struct {
|
||||||
PhotoPath string
|
PhotoPath string
|
||||||
|
IgnoreFolder []string
|
||||||
PhotoCompressPath string
|
PhotoCompressPath string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,6 +44,7 @@ func ReadConfig(path string) (Config, error) {
|
||||||
decoder.DisallowUnknownFields()
|
decoder.DisallowUnknownFields()
|
||||||
err = decoder.Decode(&cfg)
|
err = decoder.Decode(&cfg)
|
||||||
main_config.PhotoPath = cfg.PhotoPath
|
main_config.PhotoPath = cfg.PhotoPath
|
||||||
|
main_config.IgnoreFolder = cfg.IgnoreFolder
|
||||||
|
|
||||||
return main_config, err
|
return main_config, err
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,3 +29,12 @@ func InputString(print string) string {
|
||||||
}
|
}
|
||||||
return strings.TrimSpace(input)
|
return strings.TrimSpace(input)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func StringInSlice(s string, list []string) bool {
|
||||||
|
for _, v := range list {
|
||||||
|
if v == s {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue