aboutsummaryrefslogtreecommitdiff
path: root/pkg/worker
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/worker')
-rw-r--r--pkg/worker/exif_scanner.go16
-rw-r--r--pkg/worker/file_scanner.go8
2 files changed, 12 insertions, 12 deletions
diff --git a/pkg/worker/exif_scanner.go b/pkg/worker/exif_scanner.go
index 91eed12..97790a0 100644
--- a/pkg/worker/exif_scanner.go
+++ b/pkg/worker/exif_scanner.go
@@ -3,27 +3,27 @@ package worker
import (
"context"
- "git.sr.ht/~gabrielgio/img/pkg/components/media"
"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 media.Repository
+ repository repository.MediaRepository
}
)
-var _ BatchProcessor[*media.Media] = &EXIFScanner{}
+var _ BatchProcessor[*repository.Media] = &EXIFScanner{}
-func NewEXIFScanner(repository media.Repository) *EXIFScanner {
+func NewEXIFScanner(repository repository.MediaRepository) *EXIFScanner {
return &EXIFScanner{
repository: repository,
}
}
-func (e *EXIFScanner) Query(ctx context.Context) ([]*media.Media, error) {
- medias, err := e.repository.GetEmptyEXIF(ctx, &media.Pagination{
+func (e *EXIFScanner) Query(ctx context.Context) ([]*repository.Media, error) {
+ medias, err := e.repository.GetEmptyEXIF(ctx, &repository.Pagination{
Page: 0,
Size: 100,
})
@@ -34,8 +34,8 @@ func (e *EXIFScanner) Query(ctx context.Context) ([]*media.Media, error) {
return medias, nil
}
-func (e *EXIFScanner) Process(ctx context.Context, m *media.Media) error {
- exif, err := coroutine.WrapProcess(ctx, func() (*media.MediaEXIF, error) { return fileop.ReadExif(m.Path) })
+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
}
diff --git a/pkg/worker/file_scanner.go b/pkg/worker/file_scanner.go
index a51f60b..aa79035 100644
--- a/pkg/worker/file_scanner.go
+++ b/pkg/worker/file_scanner.go
@@ -9,19 +9,19 @@ import (
"path/filepath"
"strings"
- "git.sr.ht/~gabrielgio/img/pkg/components/media"
+ "git.sr.ht/~gabrielgio/img/pkg/database/repository"
)
type (
FileScanner struct {
root string
- repository media.Repository
+ repository repository.MediaRepository
}
)
var _ ChanProcessor[string] = &FileScanner{}
-func NewFileScanner(root string, repository media.Repository) *FileScanner {
+func NewFileScanner(root string, repository repository.MediaRepository) *FileScanner {
return &FileScanner{
root: root,
repository: repository,
@@ -77,7 +77,7 @@ func (f *FileScanner) Process(ctx context.Context, path string) error {
return nil
}
- return f.repository.Create(ctx, &media.CreateMedia{
+ return f.repository.Create(ctx, &repository.CreateMedia{
Name: name,
Path: path,
PathHash: str,