From 8332581bcf9191387b5229abf636a106eb81fa6a Mon Sep 17 00:00:00 2001 From: gryffyn Date: Thu, 30 Mar 2023 05:48:48 -0400 Subject: [PATCH] fix: fixed struct alloc Signed-off-by: gryffyn --- osiris.go | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/osiris.go b/osiris.go index 89875f4..c79167b 100644 --- a/osiris.go +++ b/osiris.go @@ -71,9 +71,8 @@ type args struct { } var ( - seriesTemplate = "{{ .Title }}{{if .Options.SeriesYear}} ({{ .Year }}){{end}} - {{ .Episode}}{{if ." + - "EpisodeTitle}} - {{ .EpisodeTitle}}{{end}}{{if .Options.Scene }} ({{ .Scene }}){{end}}" - filmTemplate = "{{ .Title }} ({{ .Year }}){{if .Options.Scene }} ({{ .Scene }}){{end}}" + seriesTemplate = "{{ .Title }}{{if .Options.SeriesYear}} ({{ .Year }}){{end}} - {{ .Episode}}{{if .EpisodeTitle}} - {{ .EpisodeTitle}}{{end}}{{if .Options.Scene }} ({{ .Scene }}){{end}}" + filmTemplate = "{{ .Title }} ({{ .Year }}){{if .Options.Scene }} ({{ .Scene }}){{end}}" ) func main() { @@ -164,7 +163,7 @@ func getFilename(filepath string, re *regexp.Regexp, cfg *config, year, title st return strings.ReplaceAll(s, ".", " ") }) - r := release{ + r := &release{ Title: strings.TrimSpace(strings.ReplaceAll(metadata["title"], ".", " ")), Year: strings.TrimSpace(metadata["year"]), Episode: strings.TrimSpace(strings.ToUpper(metadata["ep"])), @@ -198,9 +197,12 @@ func getFilename(filepath string, re *regexp.Regexp, cfg *config, year, title st } } - releaseTemplate, _ := template.New("release").Parse(tmpl) + releaseTemplate, err := template.New("release").Parse(tmpl) + if err != nil { + log.Fatalln(err) + } var newname bytes.Buffer - err := releaseTemplate.Execute(&newname, &r) + err = releaseTemplate.Execute(&newname, &r) if err != nil { log.Fatalln(err) }