From 28f7b6eaef9ea4fd81653e69a3c9539d97f6f53c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20H=C3=A4felfinger?= Date: Wed, 20 Mar 2019 00:31:23 +0100 Subject: [PATCH] fixed messages and stop processing if no images are ready to process --- internal/app/images.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/internal/app/images.go b/internal/app/images.go index bbeb8d4..6b8cd07 100644 --- a/internal/app/images.go +++ b/internal/app/images.go @@ -79,13 +79,18 @@ func synchronizePiwigoMetadata(piwigoCtx *piwigo.PiwigoContext, metadataStorage // Check all images with upload required if they are really changed and need to be uploaded to the server. func checkPiwigoForChangedImages(provider ImageMetadataProvider, piwigoCtx *piwigo.PiwigoContext) error { - logrus.Infof("checking for pending files that are already on piwigo and updating piwigoids...") + logrus.Infof("Checking pending files if they really differ from the version in piwigo...") images, err := provider.ImageMetadataToUpload() if err != nil { return err } + if len(images) == 0 { + logrus.Info("There are no existing images to check for modification on the server.") + return nil + } + for _, img := range images { if img.PiwigoId == 0 { continue @@ -118,6 +123,11 @@ func updatePiwigoIdIfAlreadyUploaded(provider ImageMetadataProvider, piwigoCtx * return err } + if len(images) == 0 { + logrus.Info("There are no existing images to check for modification on the server.") + return nil + } + logrus.Debugln("Preparing lookuplist for missing piwigo ids...") files := make([]string, 0, len(images)) for _, img := range images { @@ -125,6 +135,7 @@ func updatePiwigoIdIfAlreadyUploaded(provider ImageMetadataProvider, piwigoCtx * files = append(files, img.Md5Sum) } } + missingResults, err := piwigoCtx.ImagesExistOnPiwigo(files) if err != nil { return err