Первая версия (CLI-only) #1
@@ -208,14 +208,16 @@ func (w *wholeScreenCapturer) createTempDirectory() (path string, err error) {
|
|||||||
return os.MkdirTemp(w.config.Screenshot.Directory, constants.AppName+"-*")
|
return os.MkdirTemp(w.config.Screenshot.Directory, constants.AppName+"-*")
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewWholeScreenCapturer(lc fx.Lifecycle, config *config.Config, log *logger.Logger) ScreenCapturer {
|
func NewWholeScreenCapturer(
|
||||||
|
lc fx.Lifecycle, config *config.Config, log *logger.Logger,
|
||||||
|
) ScreenCapturer {
|
||||||
capturer := &wholeScreenCapturer{
|
capturer := &wholeScreenCapturer{
|
||||||
config: config,
|
config: config,
|
||||||
log: log,
|
log: log,
|
||||||
done: make(chan struct{}),
|
done: make(chan struct{}),
|
||||||
}
|
}
|
||||||
lc.Append(fx.StopHook(func(ctx context.Context) error {
|
lc.Append(fx.StopHook(func(ctx context.Context) error {
|
||||||
if (!capturer.initialized) {
|
if !capturer.initialized {
|
||||||
log.Debug("wholescreencapturer not initialized, nothing to do")
|
log.Debug("wholescreencapturer not initialized, nothing to do")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -237,4 +239,3 @@ func NewWholeScreenCapturer(lc fx.Lifecycle, config *config.Config, log *logger.
|
|||||||
}))
|
}))
|
||||||
return capturer
|
return capturer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ var (
|
|||||||
|
|
||||||
// AnalyzeImage implements Vision.
|
// AnalyzeImage implements Vision.
|
||||||
func (v *visionImpl) AnalyzeImage(filePath string) (data VisionData, err error) {
|
func (v *visionImpl) AnalyzeImage(filePath string) (data VisionData, err error) {
|
||||||
|
// TODO: scanning for multiple QR-codes at once
|
||||||
v.log.Debug("analyzing image for qr codes", "filePath", filePath)
|
v.log.Debug("analyzing image for qr codes", "filePath", filePath)
|
||||||
|
|
||||||
img := gocv.IMRead(filePath, gocv.IMReadColor)
|
img := gocv.IMRead(filePath, gocv.IMReadColor)
|
||||||
|
|||||||
Reference in New Issue
Block a user