23 lines
415 B
Go
23 lines
415 B
Go
package camera
|
|
|
|
import (
|
|
"fmt"
|
|
"os/exec"
|
|
|
|
"github.com/sirupsen/logrus"
|
|
)
|
|
|
|
var gphotoPath string
|
|
|
|
func init() {
|
|
var err error
|
|
gphotoPath, err = exec.LookPath("gphoto2")
|
|
if err != nil {
|
|
logrus.Panic("gphoto2 not found")
|
|
}
|
|
}
|
|
|
|
func TakePhoto(id string) error {
|
|
cmd := exec.Command(gphotoPath, "--capture-image-and-download", "--filename", fmt.Sprintf("images/original/ticket-%s.jpg", id))
|
|
return cmd.Run()
|
|
}
|