From 6e4c78daf28f4b98fb28fc9cd96542c3ef8993a7 Mon Sep 17 00:00:00 2001 From: Aynakeya Date: Thu, 7 Jul 2022 20:37:06 -0700 Subject: [PATCH] add empty image output --- config/config.go | 2 +- plugin/textinfo/textinfo.go | 16 +++++++++++----- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/config/config.go b/config/config.go index 96849ce..f8a7a44 100644 --- a/config/config.go +++ b/config/config.go @@ -6,7 +6,7 @@ import ( "path" ) -const VERSION = "alpha 0.8.0" +const VERSION = "alpha 0.8.1" const CONFIG_PATH = "./config.ini" const Assests_PATH = "./assets" diff --git a/plugin/textinfo/textinfo.go b/plugin/textinfo/textinfo.go index 36a481f..f15b870 100644 --- a/plugin/textinfo/textinfo.go +++ b/plugin/textinfo/textinfo.go @@ -55,14 +55,16 @@ type OutInfo struct { } type TextInfo struct { - Rendering bool - info OutInfo - templates []*Template - panel fyne.CanvasObject + Rendering bool + info OutInfo + templates []*Template + emptyCover []byte + panel fyne.CanvasObject } func NewTextInfo() *TextInfo { - return &TextInfo{Rendering: true} + b, _ := ioutil.ReadFile(config.GetAssetPath("empty.png")) + return &TextInfo{Rendering: true, emptyCover: b} } func (t *TextInfo) Title() string { @@ -166,6 +168,10 @@ func (t *TextInfo) OutputCover() { return } if !t.info.Current.Cover.Exists() { + err := ioutil.WriteFile(filepath.Join(Out_Path, "cover.jpg"), t.emptyCover, 0666) + if err != nil { + l().Warnf("write cover file failed: %s", err) + } return } if t.info.Current.Cover.Data != nil {