fixed anime episode pattern problems

This commit is contained in:
milarin 2023-01-16 00:44:30 +01:00
parent a93c5f2c84
commit 6adf6f276d
2 changed files with 6 additions and 7 deletions

View File

@ -13,16 +13,13 @@ var (
TorrentPath = envvars.String("TORRENT_PATH", "") TorrentPath = envvars.String("TORRENT_PATH", "")
DebugAnimeEpisodePattern = envvars.Object( DebugAnimeEpisodePatternStr = envvars.String("DEBUG_ANIME_EPISODE_PATTERN", `{{.Anime.Title.UserPreferred}} episode {{.Episode}}`)
"DEBUG_ANIME_EPISODE_PATTERN", DebugAnimeEpisodePattern = template.Must(template.New("DEBUG_ANIME_EPISODE_PATTERN").Parse(DebugAnimeEpisodePatternStr))
template.Must(template.New("anime-episode-filepath-pattern").Parse(`{{.Title.UserPreferred}} episode {{.Episode}}`)),
template.New("anime-episode-filepath-pattern").Parse,
)
TelegramBotToken = envvars.String("TELEGRAM_API_TOKEN", "") TelegramBotToken = envvars.String("TELEGRAM_API_TOKEN", "")
TelegramChatID = envvars.Int64("TELEGRAM_CHAT_ID", 0) 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}}`)) 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) DownloadAll = envvars.Bool("DOWNLOAD_ALL_ANIMES", false)
) )

View File

@ -63,7 +63,9 @@ func ShowDebugInfo(
} }
b := new(strings.Builder) 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) header := BoldText.Sprintf("%s (%s)", color.MagentaString(b.String()), epState)
fmt.Println(tprint.FormatHeaderTable(header, table)) fmt.Println(tprint.FormatHeaderTable(header, table))
} }