aboutsummaryrefslogtreecommitdiff
path: root/internal/service
diff options
context:
space:
mode:
Diffstat (limited to 'internal/service')
-rw-r--r--internal/service/gallery_service.go17
-rw-r--r--internal/service/new.go2
2 files changed, 18 insertions, 1 deletions
diff --git a/internal/service/gallery_service.go b/internal/service/gallery_service.go
new file mode 100644
index 0000000..90e3c09
--- /dev/null
+++ b/internal/service/gallery_service.go
@@ -0,0 +1,17 @@
+package service
+
+import (
+ "context"
+
+ "github.com/RanXom/galleryd/internal/gallery"
+)
+
+// Gallery scans the configured roots and builds the gallery.
+func (s *galleryService) Gallery(ctx context.Context) ([]gallery.Photo, error) {
+ files, err := s.scanner.Scan(ctx)
+ if err != nil {
+ return nil, err
+ }
+
+ return s.builder.Build(ctx, files)
+}
diff --git a/internal/service/new.go b/internal/service/new.go
index 97cd638..73d0af6 100644
--- a/internal/service/new.go
+++ b/internal/service/new.go
@@ -5,7 +5,7 @@ import (
"github.com/RanXom/galleryd/internal/scanner"
)
-func NewGalleryService(
+func New(
scanner *scanner.Scanner,
builder *gallery.Builder,
) GalleryService {