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", "")
|
|
|
|
|
2022-08-25 23:25:48 +02:00
|
|
|
DebugAnimeEpisodePattern = envvars.Object(
|
2023-01-15 20:59:54 +01:00
|
|
|
"DEBUG_ANIME_EPISODE_PATTERN",
|
2022-08-25 23:25:48 +02:00
|
|
|
template.Must(template.New("anime-episode-filepath-pattern").Parse(`{{.Title.UserPreferred}} episode {{.Episode}}`)),
|
2023-01-15 20:59:54 +01:00
|
|
|
template.New("anime-episode-filepath-pattern").Parse,
|
2022-08-25 23:25:48 +02:00
|
|
|
)
|
|
|
|
|
2023-01-15 20:59:54 +01:00
|
|
|
TelegramDownloadMessagePatternStr = logic.EscSeqReplacer.Replace(envvars.String("TELEGRAM_DOWNLOAD_MESSAGE_PATTERN", `Download started\n{{.Anime.Title.UserPreferred}}第{{.Episode}}話`))
|
|
|
|
TelegramDownloadMessagePattern = template.Must(template.New("telegram-download-message-pattern").Parse(TelegramDownloadMessagePatternStr))
|
|
|
|
|
2022-08-25 23:25:48 +02:00
|
|
|
DownloadAll = envvars.Bool("DOWNLOAD_ALL_ANIMES", false)
|
2023-01-15 20:59:54 +01:00
|
|
|
|
|
|
|
TelegramBotToken = envvars.String("TELEGRAM_API_TOKEN", "")
|
|
|
|
TelegramChatID = envvars.Int64("TELEGRAM_CHAT_ID", 0)
|
2022-08-25 09:04:22 +02:00
|
|
|
)
|