Add hooks functionality
This commit is contained in:
@@ -17,6 +17,7 @@ type ConfigInterface interface {
|
||||
GetPort() string
|
||||
GetDirectories() []string
|
||||
MeetsConditions(directory, torrentID, torrentName string, fileNames []string) bool
|
||||
GetOnLibraryUpdate() string
|
||||
}
|
||||
|
||||
func LoadZurgConfig(filename string) (ConfigInterface, error) {
|
||||
|
||||
@@ -8,4 +8,37 @@ type ZurgConfig struct {
|
||||
RefreshEverySeconds int `yaml:"check_for_changes_every_secs"`
|
||||
CacheTimeHours int `yaml:"info_cache_time_hours"`
|
||||
CanRepair bool `yaml:"enable_repair"`
|
||||
OnLibraryUpdate string `yaml:"on_library_update"`
|
||||
}
|
||||
|
||||
func (z *ZurgConfig) GetVersion() string {
|
||||
return "v1"
|
||||
}
|
||||
|
||||
func (z *ZurgConfig) GetToken() string {
|
||||
return z.Token
|
||||
}
|
||||
|
||||
func (z *ZurgConfig) GetPort() string {
|
||||
return z.Port
|
||||
}
|
||||
|
||||
func (z *ZurgConfig) GetNumOfWorkers() int {
|
||||
return z.NumOfWorkers
|
||||
}
|
||||
|
||||
func (z *ZurgConfig) GetRefreshEverySeconds() int {
|
||||
return z.RefreshEverySeconds
|
||||
}
|
||||
|
||||
func (z *ZurgConfig) GetCacheTimeHours() int {
|
||||
return z.CacheTimeHours
|
||||
}
|
||||
|
||||
func (z *ZurgConfig) EnableRepair() bool {
|
||||
return z.CanRepair
|
||||
}
|
||||
|
||||
func (z *ZurgConfig) GetOnLibraryUpdate() string {
|
||||
return z.OnLibraryUpdate
|
||||
}
|
||||
|
||||
@@ -17,34 +17,6 @@ func loadV1Config(content []byte) (*ZurgConfigV1, error) {
|
||||
return &configV1, nil
|
||||
}
|
||||
|
||||
func (z *ZurgConfigV1) GetVersion() string {
|
||||
return "v1"
|
||||
}
|
||||
|
||||
func (z *ZurgConfigV1) GetToken() string {
|
||||
return z.Token
|
||||
}
|
||||
|
||||
func (z *ZurgConfigV1) GetPort() string {
|
||||
return z.Port
|
||||
}
|
||||
|
||||
func (z *ZurgConfigV1) GetNumOfWorkers() int {
|
||||
return z.NumOfWorkers
|
||||
}
|
||||
|
||||
func (z *ZurgConfigV1) GetRefreshEverySeconds() int {
|
||||
return z.RefreshEverySeconds
|
||||
}
|
||||
|
||||
func (z *ZurgConfigV1) GetCacheTimeHours() int {
|
||||
return z.CacheTimeHours
|
||||
}
|
||||
|
||||
func (z *ZurgConfigV1) EnableRepair() bool {
|
||||
return z.CanRepair
|
||||
}
|
||||
|
||||
func (z *ZurgConfigV1) GetDirectories() []string {
|
||||
rootDirectories := make([]string, len(z.Directories))
|
||||
i := 0
|
||||
|
||||
Reference in New Issue
Block a user