2021-02-14 16:18:26 +00:00
|
|
|
package nabarr
|
|
|
|
|
|
2021-02-20 20:01:04 +00:00
|
|
|
import (
|
|
|
|
|
"time"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
/* pvr config / filters */
|
2021-02-14 16:18:26 +00:00
|
|
|
|
|
|
|
|
type PvrConfig struct {
|
2021-06-11 08:21:38 +01:00
|
|
|
Name string `yaml:"name"`
|
|
|
|
|
Type string `yaml:"type"`
|
|
|
|
|
URL string `yaml:"url"`
|
|
|
|
|
ApiKey string `yaml:"api_key"`
|
|
|
|
|
QualityProfile string `yaml:"quality_profile"`
|
|
|
|
|
LanguageProfile string `yaml:"language_profile"`
|
|
|
|
|
RootFolder string `yaml:"root_folder"`
|
|
|
|
|
Options struct {
|
2021-02-20 20:01:04 +00:00
|
|
|
// add options
|
|
|
|
|
AddMonitored *bool `yaml:"add_monitored"`
|
|
|
|
|
SearchMissing *bool `yaml:"search_missing"`
|
|
|
|
|
// skip objects
|
|
|
|
|
SkipAnime *bool `yaml:"skip_anime"`
|
|
|
|
|
} `yaml:"options"`
|
|
|
|
|
Filters PvrFilters `yaml:"filters"`
|
|
|
|
|
CacheDuration time.Duration `yaml:"cache_duration"`
|
|
|
|
|
Verbosity string `yaml:"verbosity,omitempty"`
|
2021-02-14 16:18:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type PvrFilters struct {
|
|
|
|
|
Ignores []string
|
|
|
|
|
}
|
2021-02-20 20:01:04 +00:00
|
|
|
|
|
|
|
|
/* pvr options */
|
|
|
|
|
|
|
|
|
|
type PvrOption func(options *PvrOptions)
|
|
|
|
|
|
|
|
|
|
type PvrOptions struct {
|
2021-02-21 14:01:21 +00:00
|
|
|
// seriesType returned from the lookup before adding (sonarr)
|
|
|
|
|
SeriesType string
|
2021-02-20 20:01:04 +00:00
|
|
|
|
|
|
|
|
AddMonitored bool
|
|
|
|
|
SearchMissing bool
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func BuildPvrOptions(opts ...PvrOption) (*PvrOptions, error) {
|
|
|
|
|
os := &PvrOptions{}
|
|
|
|
|
|
|
|
|
|
for _, opt := range opts {
|
|
|
|
|
opt(os)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return os, nil
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func WithSeriesType(seriesType string) PvrOption {
|
|
|
|
|
return func(opts *PvrOptions) {
|
2021-02-21 14:01:21 +00:00
|
|
|
opts.SeriesType = seriesType
|
2021-02-20 20:01:04 +00:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func WithAddMonitored(monitored bool) PvrOption {
|
|
|
|
|
return func(opts *PvrOptions) {
|
|
|
|
|
opts.AddMonitored = monitored
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func WithSearchMissing(missing bool) PvrOption {
|
|
|
|
|
return func(opts *PvrOptions) {
|
|
|
|
|
opts.SearchMissing = missing
|
|
|
|
|
}
|
|
|
|
|
}
|