From 6adf6f276df5908059e1eff651ead688a98525b4 Mon Sep 17 00:00:00 2001 From: milarin Date: Mon, 16 Jan 2023 00:44:30 +0100 Subject: [PATCH] fixed anime episode pattern problems --- envvars.go | 9 +++------ show_debug_info.go | 4 +++- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/envvars.go b/envvars.go index 540b466..bc62545 100644 --- a/envvars.go +++ b/envvars.go @@ -13,16 +13,13 @@ var ( TorrentPath = envvars.String("TORRENT_PATH", "") - DebugAnimeEpisodePattern = envvars.Object( - "DEBUG_ANIME_EPISODE_PATTERN", - template.Must(template.New("anime-episode-filepath-pattern").Parse(`{{.Title.UserPreferred}} episode {{.Episode}}`)), - template.New("anime-episode-filepath-pattern").Parse, - ) + DebugAnimeEpisodePatternStr = envvars.String("DEBUG_ANIME_EPISODE_PATTERN", `{{.Anime.Title.UserPreferred}} episode {{.Episode}}`) + DebugAnimeEpisodePattern = template.Must(template.New("DEBUG_ANIME_EPISODE_PATTERN").Parse(DebugAnimeEpisodePatternStr)) TelegramBotToken = envvars.String("TELEGRAM_API_TOKEN", "") TelegramChatID = envvars.Int64("TELEGRAM_CHAT_ID", 0) TelegramDownloadMessagePatternStr = logic.EscSeqReplacer.Replace(envvars.String("TELEGRAM_DOWNLOAD_MESSAGE_PATTERN", `Download started\n\n{{.Title.UserPreferred}} episode {{.Episode}}`)) - TelegramDownloadMessagePattern = template.Must(template.New("telegram-download-message-pattern").Parse(TelegramDownloadMessagePatternStr)) + TelegramDownloadMessagePattern = template.Must(template.New("TELEGRAM_DOWNLOAD_MESSAGE_PATTERN").Parse(TelegramDownloadMessagePatternStr)) DownloadAll = envvars.Bool("DOWNLOAD_ALL_ANIMES", false) ) diff --git a/show_debug_info.go b/show_debug_info.go index 1b027c0..e7f8767 100644 --- a/show_debug_info.go +++ b/show_debug_info.go @@ -63,7 +63,9 @@ func ShowDebugInfo( } b := new(strings.Builder) - DebugAnimeEpisodePattern.Execute(b, animeEp) + if err := DebugAnimeEpisodePattern.Execute(b, animeEp); err != nil { + panic(err) + } header := BoldText.Sprintf("%s (%s)", color.MagentaString(b.String()), epState) fmt.Println(tprint.FormatHeaderTable(header, table)) }