2022-08-25 09:04:22 +02:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
2023-01-15 20:59:54 +01:00
|
|
|
"text/template"
|
2022-08-25 09:04:22 +02:00
|
|
|
"time"
|
|
|
|
|
2022-08-25 10:26:57 +02:00
|
|
|
"git.milar.in/milarin/envvars/v2"
|
2023-01-15 20:59:54 +01:00
|
|
|
"git.milar.in/nyaanime/logic"
|
2022-08-25 09:04:22 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
var (
|
2022-08-26 18:27:54 +02:00
|
|
|
PollRate = envvars.Object("POLL_RATE", 30*time.Minute, time.ParseDuration)
|
2022-08-25 09:04:22 +02:00
|
|
|
|
|
|
|
TorrentPath = envvars.String("TORRENT_PATH", "")
|
|
|
|
|
2023-01-16 00:44:30 +01:00
|
|
|
DebugAnimeEpisodePatternStr = envvars.String("DEBUG_ANIME_EPISODE_PATTERN", `{{.Anime.Title.UserPreferred}} episode {{.Episode}}`)
|
|
|
|
DebugAnimeEpisodePattern = template.Must(template.New("DEBUG_ANIME_EPISODE_PATTERN").Parse(DebugAnimeEpisodePatternStr))
|
2022-08-25 23:25:48 +02:00
|
|
|
|
2023-01-15 21:06:48 +01:00
|
|
|
TelegramBotToken = envvars.String("TELEGRAM_API_TOKEN", "")
|
|
|
|
TelegramChatID = envvars.Int64("TELEGRAM_CHAT_ID", 0)
|
2023-01-17 10:50:07 +01:00
|
|
|
TelegramDownloadMessagePatternStr = logic.EscSeqReplacer.Replace(envvars.String("TELEGRAM_DOWNLOAD_MESSAGE_PATTERN", `Download started{{range .}}\n{{.Anime.Title.UserPreferred}} episode {{.Episode}}{{end}}`))
|
2023-01-16 00:44:30 +01:00
|
|
|
TelegramDownloadMessagePattern = template.Must(template.New("TELEGRAM_DOWNLOAD_MESSAGE_PATTERN").Parse(TelegramDownloadMessagePatternStr))
|
2023-01-15 20:59:54 +01:00
|
|
|
|
2022-08-25 23:25:48 +02:00
|
|
|
DownloadAll = envvars.Bool("DOWNLOAD_ALL_ANIMES", false)
|
2022-08-25 09:04:22 +02:00
|
|
|
)
|