-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathpvr.go
71 lines (57 loc) · 1.48 KB
/
pvr.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package nabarr
import (
"time"
)
/* pvr config / filters */
type PvrConfig struct {
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 {
// 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"`
}
type PvrFilters struct {
Ignores []string
}
/* pvr options */
type PvrOption func(options *PvrOptions)
type PvrOptions struct {
// seriesType returned from the lookup before adding (sonarr)
SeriesType string
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) {
opts.SeriesType = seriesType
}
}
func WithAddMonitored(monitored bool) PvrOption {
return func(opts *PvrOptions) {
opts.AddMonitored = monitored
}
}
func WithSearchMissing(missing bool) PvrOption {
return func(opts *PvrOptions) {
opts.SearchMissing = missing
}
}