Skip to content

Commit b131e4b

Browse files
committed
remove accepts
1 parent d63d13e commit b131e4b

File tree

4 files changed

+0
-64
lines changed

4 files changed

+0
-64
lines changed

config/pvr.go

-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,4 @@ type Pvr struct {
1010

1111
type PvrFilters struct {
1212
Ignores []string
13-
Accepts []string
1413
}

pvr/interface.go

-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import (
77
type Interface interface {
88
Init(MediaType) error
99
ShouldIgnore(*config.MediaItem) (bool, error)
10-
ShouldAccept(*config.MediaItem) (bool, error)
1110

1211
GetQualityProfileId(string) (int, error)
1312
GetExistingMedia() (map[string]config.MediaItem, error)

pvr/radarr.go

-31
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ type Radarr struct {
2525
qualityProfileId int
2626

2727
ignoresExpr []*vm.Program
28-
acceptsExpr []*vm.Program
2928
}
3029

3130
type RadarrSystemStatus struct {
@@ -106,16 +105,6 @@ func (p *Radarr) compileExpressions() error {
106105
p.ignoresExpr = append(p.ignoresExpr, program)
107106
}
108107

109-
// compile accepts
110-
for _, acceptExpr := range p.cfg.Filters.Accepts {
111-
program, err := expr.Compile(acceptExpr, expr.Env(exprEnv), expr.AsBool())
112-
if err != nil {
113-
return errors.Wrapf(err, "failed compiling accept expression for: %q", acceptExpr)
114-
}
115-
116-
p.acceptsExpr = append(p.acceptsExpr, program)
117-
}
118-
119108
return nil
120109
}
121110

@@ -185,26 +174,6 @@ func (p *Radarr) ShouldIgnore(mediaItem *config.MediaItem) (bool, error) {
185174
return false, nil
186175
}
187176

188-
func (p *Radarr) ShouldAccept(mediaItem *config.MediaItem) (bool, error) {
189-
for _, expression := range p.acceptsExpr {
190-
result, err := expr.Run(expression, mediaItem)
191-
if err != nil {
192-
return false, errors.Wrapf(err, "failed checking accept expression")
193-
}
194-
195-
expResult, ok := result.(bool)
196-
if !ok {
197-
return false, errors.New("failed type asserting accept expression result")
198-
}
199-
200-
if expResult {
201-
return true, nil
202-
}
203-
}
204-
205-
return false, nil
206-
}
207-
208177
func (p *Radarr) GetQualityProfileId(profileName string) (int, error) {
209178
// send request
210179
resp, err := web.GetResponse(web.GET, web.JoinURL(p.apiUrl, "/profile"), 15, p.reqHeaders,

pvr/sonarr.go

-31
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ type Sonarr struct {
2525
qualityProfileId int
2626

2727
ignoresExpr []*vm.Program
28-
acceptsExpr []*vm.Program
2928
}
3029

3130
type SonarrSystemStatus struct {
@@ -105,16 +104,6 @@ func (p *Sonarr) compileExpressions() error {
105104
p.ignoresExpr = append(p.ignoresExpr, program)
106105
}
107106

108-
// compile accepts
109-
for _, acceptExpr := range p.cfg.Filters.Accepts {
110-
program, err := expr.Compile(acceptExpr, expr.Env(exprEnv), expr.AsBool())
111-
if err != nil {
112-
return errors.Wrapf(err, "failed compiling accept expression for: %q", acceptExpr)
113-
}
114-
115-
p.acceptsExpr = append(p.acceptsExpr, program)
116-
}
117-
118107
return nil
119108
}
120109

@@ -184,26 +173,6 @@ func (p *Sonarr) ShouldIgnore(mediaItem *config.MediaItem) (bool, error) {
184173
return false, nil
185174
}
186175

187-
func (p *Sonarr) ShouldAccept(mediaItem *config.MediaItem) (bool, error) {
188-
for _, expression := range p.acceptsExpr {
189-
result, err := expr.Run(expression, mediaItem)
190-
if err != nil {
191-
return false, errors.Wrapf(err, "failed checking accept expression")
192-
}
193-
194-
expResult, ok := result.(bool)
195-
if !ok {
196-
return false, errors.New("failed type asserting accept expression result")
197-
}
198-
199-
if expResult {
200-
return true, nil
201-
}
202-
}
203-
204-
return false, nil
205-
}
206-
207176
func (p *Sonarr) GetQualityProfileId(profileName string) (int, error) {
208177
// send request
209178
resp, err := web.GetResponse(web.GET, web.JoinURL(p.apiUrl, "/profile"), 15, p.reqHeaders,

0 commit comments

Comments
 (0)