diff --git a/internal/slideshow/slideshow.go b/internal/slideshow/slideshow.go index e6a961e..1ab82e4 100644 --- a/internal/slideshow/slideshow.go +++ b/internal/slideshow/slideshow.go @@ -13,7 +13,8 @@ import ( "git.velvettear.de/velvettear/slideshow/internal/watcher" ) -// internal counter +var previousImage string + // start the slideshow func Start() { loggo.Info("starting the image slideshow...", "interval: "+strconv.FormatFloat(config.Interval.Seconds(), 'f', 0, 64)+" seconds") @@ -22,7 +23,13 @@ func Start() { scaleImages := config.IsResolutionSet() for { var data []byte - image := watcher.GetRandomImage() + var image string + for { + image = watcher.GetRandomImage() + if image != previousImage { + break + } + } if scaleImages { scaleTimestamp := time.Now() tmp, error := scale(image) @@ -34,7 +41,7 @@ func Start() { scaleTime = time.Since(scaleTimestamp) } if sleepTime > 0 { - loggo.Debug("sleeping for '" + strconv.FormatInt(sleepTime.Milliseconds(), 10) + "' ms") + loggo.Debug("sleeping for " + strconv.FormatInt(sleepTime.Milliseconds(), 10) + "ms") time.Sleep(sleepTime) } if scaleImages {