slideshow/images/history.go
2023-11-16 15:26:24 +01:00

40 lines
1 KiB
Go

package images
// import (
// "errors"
// "strconv"
// "time"
// "git.velvettear.de/velvettear/image-frame/config"
// "git.velvettear.de/velvettear/loggo"
// )
// // internal history of displayed images
// var history []scaledImage
// // add a image to the history
// func addToHistory(scaledImage scaledImage) {
// timestamp := time.Now().UnixMilli()
// historyLimit := config.GetImageSlideshowHistory()
// if historyLimit <= 0 {
// return
// }
// history = append(history, scaledImage)
// diff := len(history) - historyLimit
// if diff > 0 {
// history = history[diff:]
// }
// loggo.DebugTimed("added image to history", timestamp, "history size: "+strconv.Itoa(len(history)))
// }
// // get and remove the latest image from history
// func getLatestFromHistory() (scaledImage, error) {
// var scaledImage scaledImage
// if len(history) == 0 {
// return scaledImage, errors.New("history is empty")
// }
// index := len(history) - 1
// scaledImage = history[index]
// history = history[:index]
// return scaledImage, nil
// }