aboutsummaryrefslogtreecommitdiff
path: root/pkg/worker/exif_scanner.go
diff options
context:
space:
mode:
authorGabriel Arakaki Giovanini <mail@gabrielgio.me>2023-07-04 19:01:17 +0200
committerGabriel Arakaki Giovanini <mail@gabrielgio.me>2023-07-04 19:01:17 +0200
commit05a8dbf46792adfef007a0ffbcb654026db036fa (patch)
tree386658904377c695747c3ffe4a288915b0a89917 /pkg/worker/exif_scanner.go
parent311ab744fe1bf278b18c25892497271988399e9a (diff)
downloadlens-05a8dbf46792adfef007a0ffbcb654026db036fa.tar.gz
lens-05a8dbf46792adfef007a0ffbcb654026db036fa.tar.bz2
lens-05a8dbf46792adfef007a0ffbcb654026db036fa.zip
feat: Add use based file scanner
Diffstat (limited to 'pkg/worker/exif_scanner.go')
-rw-r--r--pkg/worker/exif_scanner.go39
1 files changed, 0 insertions, 39 deletions
diff --git a/pkg/worker/exif_scanner.go b/pkg/worker/exif_scanner.go
deleted file mode 100644
index 5ea1810..0000000
--- a/pkg/worker/exif_scanner.go
+++ /dev/null
@@ -1,39 +0,0 @@
-package worker
-
-import (
- "context"
-
- "git.sr.ht/~gabrielgio/img/pkg/coroutine"
- "git.sr.ht/~gabrielgio/img/pkg/database/repository"
- "git.sr.ht/~gabrielgio/img/pkg/fileop"
-)
-
-type (
- EXIFScanner struct {
- repository repository.MediaRepository
- }
-)
-
-var _ BatchProcessor[*repository.Media] = &EXIFScanner{}
-
-func NewEXIFScanner(repository repository.MediaRepository) *EXIFScanner {
- return &EXIFScanner{
- repository: repository,
- }
-}
-
-func (e *EXIFScanner) Query(ctx context.Context) ([]*repository.Media, error) {
- return e.repository.ListEmptyEXIF(ctx, &repository.Pagination{
- Page: 0,
- Size: 100,
- })
-}
-
-func (e *EXIFScanner) Process(ctx context.Context, m *repository.Media) error {
- exif, err := coroutine.WrapProcess(ctx, func() (*repository.MediaEXIF, error) { return fileop.ReadExif(m.Path) })
- if err != nil {
- return err
- }
-
- return e.repository.CreateEXIF(ctx, m.ID, exif)
-}