From 05a8dbf46792adfef007a0ffbcb654026db036fa Mon Sep 17 00:00:00 2001 From: Gabriel Arakaki Giovanini Date: Tue, 4 Jul 2023 19:01:17 +0200 Subject: feat: Add use based file scanner --- cmd/server/main.go | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'cmd') 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 -- cgit v1.2.3