export color palette before setting the background image
This commit is contained in:
parent
65aa2e5e64
commit
e00a6e8f6e
2 changed files with 6 additions and 13 deletions
|
@ -13,7 +13,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
// write the base16 color palette to a file
|
// write the base16 color palette to a file
|
||||||
func exportPalette() error {
|
func exportPalette(image string) error {
|
||||||
if !config.IsPaletteSet() {
|
if !config.IsPaletteSet() {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,9 +13,6 @@ import (
|
||||||
"git.velvettear.de/velvettear/slideshow/internal/watcher"
|
"git.velvettear.de/velvettear/slideshow/internal/watcher"
|
||||||
)
|
)
|
||||||
|
|
||||||
// currently set image
|
|
||||||
var image string
|
|
||||||
|
|
||||||
// remember last shown image
|
// remember last shown image
|
||||||
var previousImage string
|
var previousImage string
|
||||||
|
|
||||||
|
@ -26,6 +23,7 @@ func Start() {
|
||||||
var scaleTime time.Duration
|
var scaleTime time.Duration
|
||||||
scaleImages := config.IsResolutionSet()
|
scaleImages := config.IsResolutionSet()
|
||||||
for {
|
for {
|
||||||
|
var image string
|
||||||
var data []byte
|
var data []byte
|
||||||
for {
|
for {
|
||||||
image = watcher.GetRandomImage()
|
image = watcher.GetRandomImage()
|
||||||
|
@ -43,14 +41,14 @@ func Start() {
|
||||||
data = tmp
|
data = tmp
|
||||||
scaleTime = time.Since(scaleTimestamp)
|
scaleTime = time.Since(scaleTimestamp)
|
||||||
}
|
}
|
||||||
error := exportPalette()
|
|
||||||
if error != nil {
|
|
||||||
loggo.Error("encountered an error exporting the color palette for image", "image: "+image, error.Error())
|
|
||||||
}
|
|
||||||
if sleepTime > 0 {
|
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)
|
time.Sleep(sleepTime)
|
||||||
}
|
}
|
||||||
|
error := exportPalette(image)
|
||||||
|
if error != nil {
|
||||||
|
loggo.Error("encountered an error exporting the color palette for image", "image: "+image, error.Error())
|
||||||
|
}
|
||||||
if scaleImages {
|
if scaleImages {
|
||||||
error := setBackgroundPiped(data)
|
error := setBackgroundPiped(data)
|
||||||
if error != nil {
|
if error != nil {
|
||||||
|
@ -136,8 +134,3 @@ func setBackgroundPiped(data []byte) error {
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// get currently shown image
|
|
||||||
func GetImage() string {
|
|
||||||
return image
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue