Remove unnecessary configs

This commit is contained in:
Ben Sarmiento
2023-12-02 20:17:58 +01:00
parent 1d5f7fb1b6
commit e4bdecd979
2 changed files with 11 additions and 29 deletions

View File

@@ -14,13 +14,11 @@ type ConfigInterface interface {
MeetsConditions(directory, torrentName string, torrentIDs, fileNames []string) bool MeetsConditions(directory, torrentName string, torrentIDs, fileNames []string) bool
GetOnLibraryUpdate() string GetOnLibraryUpdate() string
GetNetworkBufferSize() int GetNetworkBufferSize() int
GetMountPoint() string
EnableRetainFolderNameExtension() bool EnableRetainFolderNameExtension() bool
EnableRetainRDTorrentName() bool EnableRetainRDTorrentName() bool
GetRandomPreferredHost() string GetRandomPreferredHost() string
ShouldServeFromRclone() bool ShouldServeFromRclone() bool
ShouldForceIPv6() bool ShouldForceIPv6() bool
GetRateLimitSleepSeconds() int
GetRealDebridTimeout() int GetRealDebridTimeout() int
GetRetriesUntilFailed() int GetRetriesUntilFailed() int
EnableDownloadCache() bool EnableDownloadCache() bool
@@ -32,12 +30,10 @@ type ZurgConfig struct {
Host string `yaml:"host"` Host string `yaml:"host"`
Port string `yaml:"port"` Port string `yaml:"port"`
NumOfWorkers int `yaml:"concurrent_workers"` NumOfWorkers int `yaml:"concurrent_workers"`
RateLimitSleepSeconds int `yaml:"rate_limit_sleep_secs"`
RefreshEverySeconds int `yaml:"check_for_changes_every_secs"` RefreshEverySeconds int `yaml:"check_for_changes_every_secs"`
CanRepair bool `yaml:"enable_repair"` CanRepair bool `yaml:"enable_repair"`
OnLibraryUpdate string `yaml:"on_library_update"` OnLibraryUpdate string `yaml:"on_library_update"`
NetworkBufferSize int `yaml:"network_buffer_size"` NetworkBufferSize int `yaml:"network_buffer_size"`
MountPoint string `yaml:"mount_point"`
RetainFolderNameExtension bool `yaml:"retain_folder_name_extension"` RetainFolderNameExtension bool `yaml:"retain_folder_name_extension"`
RetainRDTorrentName bool `yaml:"retain_rd_torrent_name"` RetainRDTorrentName bool `yaml:"retain_rd_torrent_name"`
PreferredHosts []string `yaml:"preferred_hosts"` PreferredHosts []string `yaml:"preferred_hosts"`
@@ -95,13 +91,6 @@ func (z *ZurgConfig) GetNetworkBufferSize() int {
return z.NetworkBufferSize return z.NetworkBufferSize
} }
func (z *ZurgConfig) GetMountPoint() string {
if z.MountPoint == "" {
return "/app/mnt"
}
return z.MountPoint
}
func (z *ZurgConfig) EnableRetainFolderNameExtension() bool { func (z *ZurgConfig) EnableRetainFolderNameExtension() bool {
return z.RetainFolderNameExtension return z.RetainFolderNameExtension
} }
@@ -126,20 +115,6 @@ func (z *ZurgConfig) ShouldForceIPv6() bool {
return z.ForceIPv6 return z.ForceIPv6
} }
func (z *ZurgConfig) GetRateLimitSleepSeconds() int {
if z.RateLimitSleepSeconds == 0 {
return 4
}
return z.RateLimitSleepSeconds
}
func (z *ZurgConfig) GetRealDebridTimeout() int {
if z.RealDebridTimeout == 0 {
return 60
}
return z.RealDebridTimeout
}
func (z *ZurgConfig) GetRetriesUntilFailed() int { func (z *ZurgConfig) GetRetriesUntilFailed() int {
if z.RetriesUntilFailed == 0 { if z.RetriesUntilFailed == 0 {
return 5 return 5
@@ -150,3 +125,10 @@ func (z *ZurgConfig) GetRetriesUntilFailed() int {
func (z *ZurgConfig) EnableDownloadCache() bool { func (z *ZurgConfig) EnableDownloadCache() bool {
return z.UseDownloadCache return z.UseDownloadCache
} }
func (z *ZurgConfig) GetRealDebridTimeout() int {
if z.RealDebridTimeout == 0 {
return 60
}
return z.RealDebridTimeout
}

View File

@@ -155,23 +155,23 @@ func (t *TorrentManager) RefreshTorrents() {
} }
t.log.Infof("Compiled into %d torrents, %d were missing info", oldTorrents.Count(), noInfoCount) t.log.Infof("Compiled into %d torrents, %d were missing info", oldTorrents.Count(), noInfoCount)
somthingChanged := false somethingChanged := false
// removed // removed
strset.Difference(t.accessKeySet, freshKeys).Each(func(accessKey string) bool { strset.Difference(t.accessKeySet, freshKeys).Each(func(accessKey string) bool {
somthingChanged = true somethingChanged = true
t.Delete(accessKey, false, false) t.Delete(accessKey, false, false)
return true return true
}) })
// new // new
strset.Difference(freshKeys, t.accessKeySet).Each(func(accessKey string) bool { strset.Difference(freshKeys, t.accessKeySet).Each(func(accessKey string) bool {
somthingChanged = true somethingChanged = true
torrent, _ := oldTorrents.Get(accessKey) torrent, _ := oldTorrents.Get(accessKey)
t.UpdateTorrentResponseCache(torrent) t.UpdateTorrentResponseCache(torrent)
t.accessKeySet.Add(accessKey) t.accessKeySet.Add(accessKey)
return true return true
}) })
// now we can build the directory responses // now we can build the directory responses
if somthingChanged { if somethingChanged {
t.UpdateDirectoryResponsesCache() t.UpdateDirectoryResponsesCache()
} }