forked from mtib/newlapse
-
Notifications
You must be signed in to change notification settings - Fork 0
/
newlapse.go
52 lines (46 loc) · 1.41 KB
/
newlapse.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package main
import (
"flag"
"fmt"
"os"
"github.com/klianc09/newlapse/capture"
"github.com/mtib/newlapse/convert"
"github.com/mtib/newlapse/crop"
)
var (
taskCrop = flag.Bool("crop", false, "tells newlapse to crop")
taskCapture = flag.Bool("capture", false, "tells newlapse to capture")
taskConvert = flag.Bool("convert", false, "tells newlapse to convert %%ds folders to videos")
taskCCC = flag.Bool("ccc", false, "equals '-capture -crop -convert'")
captureInterval = flag.Int("rate", 10, "seconds to wait between scrots")
folder = flag.String("folder", "./capture", "which folder to do something with")
fps = flag.Int("fps", 20, "ffmpeg framerate for videos")
config = flag.String("config", "nil", "config to read screensetup from for cropping")
quality = flag.Int("quality", 100, "quality of captures")
)
func main() {
flag.Parse()
if *taskCCC {
taskCrop = taskCCC
taskCapture = taskCCC
taskConvert = taskCCC
}
if *taskCapture {
if _, err := os.Stat(*folder); err != nil {
os.MkdirAll(*folder, os.ModePerm)
}
fmt.Println(`capturing into folder:`, *folder)
capture.Folder(*folder, *captureInterval, *quality)
}
if *taskCrop {
fmt.Println(`cropping folder:`, *folder)
if *config != "nil" {
crop.ConfigFolder(*folder, crop.ReadConfig(*config))
} else {
crop.Folder(*folder)
}
}
if *taskConvert {
convert.Folder(*fps)
}
}