From 0d9579534d8eecbde5ee4812d3390b7e7f453e42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=A4felfinger?= Date: Sat, 23 Mar 2019 23:33:44 +0100 Subject: [PATCH] moved the filesystem scan to a own function --- internal/app/images.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/internal/app/images.go b/internal/app/images.go index 221f04a..ea10641 100644 --- a/internal/app/images.go +++ b/internal/app/images.go @@ -24,6 +24,16 @@ func synchronizeLocalImageMetadata(metadataStorage ImageMetadataProvider, fileSy logrus.Debugf("Starting synchronizeLocalImageMetadata") logrus.Info("Synchronizing local image metadata database with local available images") + err := synchronizeLocalImageMetadataScanNewFiles(fileSystemNodes, metadataStorage, categories, checksumCalculator) + if err != nil { + return err + } + + logrus.Debugf("Finished synchronizeLocalImageMetadata") + return nil +} + +func synchronizeLocalImageMetadataScanNewFiles(fileSystemNodes map[string]*localFileStructure.FilesystemNode, metadataStorage ImageMetadataProvider, categories map[string]*piwigo.PiwigoCategory, checksumCalculator fileChecksumCalculator) error { for _, file := range fileSystemNodes { if file.IsDir { // we are only interested in files not directories @@ -68,8 +78,6 @@ func synchronizeLocalImageMetadata(metadataStorage ImageMetadataProvider, fileSy return err } } - - logrus.Debugf("Finished synchronizeLocalImageMetadata") return nil }