configurable input directory
This commit is contained in:
parent
11983d971b
commit
6c29d534d5
@ -9,6 +9,7 @@ import (
|
|||||||
type Config struct {
|
type Config struct {
|
||||||
Method string `json:method`
|
Method string `json:method`
|
||||||
OutputDir string `json:outputdir`
|
OutputDir string `json:outputdir`
|
||||||
|
InputDir string `json:inputdir`
|
||||||
BaseImage string `json:baseimage`
|
BaseImage string `json:baseimage`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
fs.go
2
fs.go
@ -53,7 +53,7 @@ func getImagesList(path string) []string {
|
|||||||
// Randomly choose x number of image from a given folder
|
// Randomly choose x number of image from a given folder
|
||||||
func getRandomImage() string {
|
func getRandomImage() string {
|
||||||
rand.Seed(time.Now().UnixNano())
|
rand.Seed(time.Now().UnixNano())
|
||||||
dir := getImagesList("/home/gator/Photos/")
|
dir := getImagesList(ConfigRegister.InputDir)
|
||||||
index := rand.Intn(len(dir))
|
index := rand.Intn(len(dir))
|
||||||
return dir[index]
|
return dir[index]
|
||||||
}
|
}
|
||||||
|
1
main.go
1
main.go
@ -11,6 +11,7 @@ func main() {
|
|||||||
// command line arguments
|
// command line arguments
|
||||||
flag.StringVar(&ConfigRegister.Method, "blending", "darken", "Blending methods : darken, lighten, fuckyfun")
|
flag.StringVar(&ConfigRegister.Method, "blending", "darken", "Blending methods : darken, lighten, fuckyfun")
|
||||||
flag.StringVar(&ConfigRegister.OutputDir, "output", "./", "Output directory")
|
flag.StringVar(&ConfigRegister.OutputDir, "output", "./", "Output directory")
|
||||||
|
flag.StringVar(&ConfigRegister.InputDir, "input", "/home/gator/Photos", "Input directory. Where to look the images from")
|
||||||
flag.StringVar(&ConfigRegister.BaseImage, "base-img", "", "Path to the base image to work with. Random image if not set")
|
flag.StringVar(&ConfigRegister.BaseImage, "base-img", "", "Path to the base image to work with. Random image if not set")
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user