Dump torrents job

This commit is contained in:
Ben Sarmiento
2024-05-26 03:49:16 +02:00
parent 249eebbea9
commit 17059e6a4a
5 changed files with 114 additions and 9 deletions

View File

@@ -30,6 +30,8 @@ type ConfigInterface interface {
GetRateLimitSleepSecs() int
ShouldDeleteRarFiles() bool
GetDownloadsEveryMins() int
GetDownloadsLimit() int
GetDumpTorrentsEveryMins() int
GetPlayableExtensions() []string
GetTorrentsCount() int
}
@@ -42,6 +44,8 @@ type ZurgConfig struct {
CanRepair bool `yaml:"enable_repair" json:"enable_repair"`
DeleteRarFiles bool `yaml:"auto_delete_rar_torrents" json:"auto_delete_rar_torrents"`
DownloadsEveryMins int `yaml:"downloads_every_mins" json:"downloads_every_mins"`
DownloadsLimit int `yaml:"downloads_limit" json:"downloads_limit"`
DumpTorrentsEveryMins int `yaml:"dump_torrents_every_mins" json:"dump_torrents_every_mins"`
DownloadTimeoutSecs int `yaml:"download_timeout_secs" json:"download_timeout_secs"`
ForceIPv6 bool `yaml:"force_ipv6" json:"force_ipv6"`
Host string `yaml:"host" json:"host"`
@@ -132,6 +136,20 @@ func (z *ZurgConfig) GetDownloadsEveryMins() int {
return z.DownloadsEveryMins
}
func (z *ZurgConfig) GetDownloadsLimit() int {
if z.DownloadsLimit == 0 {
return 50000
}
return z.DownloadsLimit
}
func (z *ZurgConfig) GetDumpTorrentsEveryMins() int {
if z.DumpTorrentsEveryMins == 0 {
return 60
}
return z.DumpTorrentsEveryMins
}
func (z *ZurgConfig) EnableRepair() bool {
return z.CanRepair
}