aboutsummaryrefslogtreecommitdiff
path: root/cmd/server
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 /cmd/server
parent311ab744fe1bf278b18c25892497271988399e9a (diff)
downloadlens-05a8dbf46792adfef007a0ffbcb654026db036fa.tar.gz
lens-05a8dbf46792adfef007a0ffbcb654026db036fa.tar.bz2
lens-05a8dbf46792adfef007a0ffbcb654026db036fa.zip
feat: Add use based file scanner
Diffstat (limited to 'cmd/server')
-rw-r--r--cmd/server/main.go12
1 files changed, 5 insertions, 7 deletions
diff --git a/cmd/server/main.go b/cmd/server/main.go
index c064d56..b81b291 100644
--- a/cmd/server/main.go
+++ b/cmd/server/main.go
@@ -24,6 +24,7 @@ import (
"git.sr.ht/~gabrielgio/img/pkg/service"
"git.sr.ht/~gabrielgio/img/pkg/view"
"git.sr.ht/~gabrielgio/img/pkg/worker"
+ "git.sr.ht/~gabrielgio/img/pkg/worker/scanner"
)
func main() {
@@ -34,9 +35,6 @@ func main() {
logLevel = flag.String("log-level", "error", "Log level: Choose either trace, debug, info, warning, error, fatal or panic")
schedulerCount = flag.Uint("scheduler-count", 10, "How many workers are created to process media files")
cachePath = flag.String("cache-path", "", "Folder to store thumbnail image")
-
- // TODO: this will later be replaced by user specific root folder
- root = flag.String("root", "", "root folder for the whole application. All the workers will use it as working directory")
)
flag.Parse()
@@ -76,7 +74,7 @@ func main() {
var (
userRepository = sql.NewUserRepository(db)
settingsRepository = sql.NewSettingsRespository(db)
- fileSystemRepository = localfs.NewFileSystemRepository(*root)
+ fileSystemRepository = localfs.NewFileSystemRepository()
mediaRepository = sql.NewMediaRepository(db)
)
@@ -113,9 +111,9 @@ func main() {
// processors
var (
- fileScanner = worker.NewFileScanner(*root, mediaRepository)
- exifScanner = worker.NewEXIFScanner(mediaRepository)
- thumbnailScanner = worker.NewThumbnailScanner(*cachePath, mediaRepository)
+ fileScanner = scanner.NewFileScanner(mediaRepository, userRepository)
+ exifScanner = scanner.NewEXIFScanner(mediaRepository)
+ thumbnailScanner = scanner.NewThumbnailScanner(*cachePath, mediaRepository)
)
// worker