Add new config - number_of_hosts

This commit is contained in:
Ben Adrian Sarmiento
2024-06-17 17:27:07 +02:00
parent f33c2411e0
commit ad06d8fea3
3 changed files with 39 additions and 39 deletions

View File

@@ -7,34 +7,35 @@ import (
)
type ConfigInterface interface {
GetConfig() ZurgConfig
GetVersion() string
GetToken() string
GetNumOfWorkers() int
GetRefreshEverySecs() int
GetRepairEveryMins() int
EnableRepair() bool
GetHost() string
GetPort() string
GetUsername() string
GetPassword() string
GetDirectories() []string
MeetsConditions(directory, torrentName string, torrentSize int64, torrentIDs, fileNames []string, fileSizes []int64, mediaInfos []*ffprobe.ProbeData) bool
GetOnLibraryUpdate() string
GetNetworkBufferSize() int
EnableRetainFolderNameExtension() bool
EnableRetainRDTorrentName() bool
GetApiTimeoutSecs() int
GetConfig() ZurgConfig
GetDirectories() []string
GetDownloadsEveryMins() int
GetDownloadTimeoutSecs() int
GetDumpTorrentsEveryMins() int
GetHost() string
GetNetworkBufferSize() int
GetNumberOfHosts() int
GetNumberOfWorkers() int
GetOnLibraryUpdate() string
GetPassword() string
GetPlayableExtensions() []string
GetPort() string
GetProxy() string
GetRarAction() string
GetRefreshEverySecs() int
GetRepairEveryMins() int
GetRetriesUntilFailed() int
GetToken() string
GetUsername() string
GetVersion() string
MeetsConditions(directory, torrentName string, torrentSize int64, torrentIDs, fileNames []string, fileSizes []int64, mediaInfos []*ffprobe.ProbeData) bool
ShouldForceIPv6() bool
ShouldIgnoreRenames() bool
ShouldServeFromRclone() bool
ShouldForceIPv6() bool
GetApiTimeoutSecs() int
GetDownloadTimeoutSecs() int
GetRetriesUntilFailed() int
GetRarAction() string
GetDownloadsEveryMins() int
GetDumpTorrentsEveryMins() int
GetPlayableExtensions() []string
GetProxy() string
}
type ZurgConfig struct {
@@ -44,18 +45,20 @@ type ZurgConfig struct {
ApiTimeoutSecs int `yaml:"api_timeout_secs" json:"api_timeout_secs"`
CanRepair bool `yaml:"enable_repair" json:"enable_repair"`
DownloadsEveryMins int `yaml:"downloads_every_mins" json:"downloads_every_mins"`
DumpTorrentsEveryMins int `yaml:"dump_torrents_every_mins" json:"dump_torrents_every_mins"`
DownloadTimeoutSecs int `yaml:"download_timeout_secs" json:"download_timeout_secs"`
DumpTorrentsEveryMins int `yaml:"dump_torrents_every_mins" json:"dump_torrents_every_mins"`
ForceIPv6 bool `yaml:"force_ipv6" json:"force_ipv6"`
Host string `yaml:"host" json:"host"`
IgnoreRenames bool `yaml:"ignore_renames" json:"ignore_renames"`
NetworkBufferSize int `yaml:"network_buffer_size" json:"network_buffer_size"`
NumberOfHosts int `yaml:"number_of_hosts" json:"number_of_hosts"`
NumOfWorkers int `yaml:"concurrent_workers" json:"concurrent_workers"`
OnLibraryUpdate string `yaml:"on_library_update" json:"on_library_update"`
Password string `yaml:"password" json:"password"`
PlayableExtensions []string `yaml:"addl_playable_extensions" json:"addl_playable_extensions"`
Port string `yaml:"port" json:"port"`
Proxy string `yaml:"proxy" json:"proxy"`
RarAction string `yaml:"rar_action" json:"rar_action"`
RefreshEverySecs int `yaml:"check_for_changes_every_secs" json:"check_for_changes_every_secs"`
RepairEveryMins int `yaml:"repair_every_mins" json:"repair_every_mins"`
RetainFolderNameExtension bool `yaml:"retain_folder_name_extension" json:"retain_folder_name_extension"`
@@ -63,7 +66,6 @@ type ZurgConfig struct {
RetriesUntilFailed int `yaml:"retries_until_failed" json:"retries_until_failed"`
ServeFromRclone bool `yaml:"serve_from_rclone" json:"serve_from_rclone"`
Username string `yaml:"username" json:"username"`
RarAction string `yaml:"rar_action" json:"rar_action"`
}
func (z *ZurgConfig) GetConfig() ZurgConfig {
@@ -99,7 +101,7 @@ func (z *ZurgConfig) GetPassword() string {
return z.Password
}
func (z *ZurgConfig) GetNumOfWorkers() int {
func (z *ZurgConfig) GetNumberOfWorkers() int {
if z.NumOfWorkers == 0 {
return 20
}
@@ -211,3 +213,10 @@ func (z *ZurgConfig) GetPlayableExtensions() []string {
func (z *ZurgConfig) GetProxy() string {
return z.Proxy
}
func (z *ZurgConfig) GetNumberOfHosts() int {
if z.NumberOfHosts == 0 {
return 20
}
return z.NumberOfHosts
}