mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
refactor(filters): music sources to media (#104)
This commit is contained in:
parent
373c85f060
commit
9b85f512e5
8 changed files with 145 additions and 35 deletions
|
@ -57,19 +57,19 @@ type Filter struct {
|
|||
ExceptReleaseTypes string `json:"except_release_types"`
|
||||
Formats []string `json:"formats"` // MP3, FLAC, Ogg, AAC, AC3, DTS
|
||||
Quality []string `json:"quality"` // 192, 320, APS (VBR), V2 (VBR), V1 (VBR), APX (VBR), V0 (VBR), q8.x (VBR), Lossless, 24bit Lossless, Other
|
||||
//Media []string `json:"media"` // CD, DVD, Vinyl, Soundboard, SACD, DAT, Cassette, WEB, Other
|
||||
PerfectFlac bool `json:"perfect_flac"`
|
||||
Cue bool `json:"cue"`
|
||||
Log bool `json:"log"`
|
||||
LogScore int `json:"log_score"`
|
||||
MatchCategories string `json:"match_categories"`
|
||||
ExceptCategories string `json:"except_categories"`
|
||||
MatchUploaders string `json:"match_uploaders"`
|
||||
ExceptUploaders string `json:"except_uploaders"`
|
||||
Tags string `json:"tags"`
|
||||
ExceptTags string `json:"except_tags"`
|
||||
TagsAny string `json:"tags_any"`
|
||||
ExceptTagsAny string `json:"except_tags_any"`
|
||||
Actions []Action `json:"actions"`
|
||||
Indexers []Indexer `json:"indexers"`
|
||||
Media []string `json:"media"` // CD, DVD, Vinyl, Soundboard, SACD, DAT, Cassette, WEB, Other
|
||||
PerfectFlac bool `json:"perfect_flac"`
|
||||
Cue bool `json:"cue"`
|
||||
Log bool `json:"log"`
|
||||
LogScore int `json:"log_score"`
|
||||
MatchCategories string `json:"match_categories"`
|
||||
ExceptCategories string `json:"except_categories"`
|
||||
MatchUploaders string `json:"match_uploaders"`
|
||||
ExceptUploaders string `json:"except_uploaders"`
|
||||
Tags string `json:"tags"`
|
||||
ExceptTags string `json:"except_tags"`
|
||||
TagsAny string `json:"tags_any"`
|
||||
ExceptTagsAny string `json:"except_tags_any"`
|
||||
Actions []Action `json:"actions"`
|
||||
Indexers []Indexer `json:"indexers"`
|
||||
}
|
||||
|
|
|
@ -847,6 +847,11 @@ func (r *Release) CheckFilter(filter Filter) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
if len(filter.Media) > 0 && !checkFilterSource(r.Source, filter.Media) {
|
||||
r.addRejection("source not matching")
|
||||
return false
|
||||
}
|
||||
|
||||
if filter.Log && r.HasLog != filter.Log {
|
||||
r.addRejection("wanted: log")
|
||||
return false
|
||||
|
|
|
@ -1069,7 +1069,7 @@ func TestRelease_CheckFilter(t *testing.T) {
|
|||
Enabled: true,
|
||||
MatchCategories: "Album",
|
||||
Artists: "Artist",
|
||||
Sources: []string{"CD"},
|
||||
Media: []string{"CD"},
|
||||
Formats: []string{"FLAC"},
|
||||
Quality: []string{"24bit Lossless"},
|
||||
Log: true,
|
||||
|
@ -1137,7 +1137,7 @@ func TestRelease_CheckFilter(t *testing.T) {
|
|||
Enabled: true,
|
||||
MatchCategories: "Album",
|
||||
Artists: "Artist",
|
||||
Sources: []string{"CD"},
|
||||
Media: []string{"CD"},
|
||||
Formats: []string{"FLAC"},
|
||||
Quality: []string{"24bit Lossless"},
|
||||
//PerfectFlac: true,
|
||||
|
@ -1162,7 +1162,7 @@ func TestRelease_CheckFilter(t *testing.T) {
|
|||
MatchReleaseTypes: []string{"Album"},
|
||||
Years: "2020-2022",
|
||||
Artists: "Artist",
|
||||
Sources: []string{"CD"},
|
||||
Media: []string{"CD"},
|
||||
Formats: []string{"FLAC"},
|
||||
Quality: []string{"24bit Lossless", "Lossless"},
|
||||
PerfectFlac: true,
|
||||
|
@ -1185,7 +1185,7 @@ func TestRelease_CheckFilter(t *testing.T) {
|
|||
Enabled: true,
|
||||
MatchReleaseTypes: []string{"Single"},
|
||||
Artists: "Artist",
|
||||
Sources: []string{"CD"},
|
||||
Media: []string{"CD"},
|
||||
Formats: []string{"FLAC"},
|
||||
Quality: []string{"24bit Lossless", "Lossless"},
|
||||
PerfectFlac: true,
|
||||
|
@ -1208,7 +1208,7 @@ func TestRelease_CheckFilter(t *testing.T) {
|
|||
Enabled: true,
|
||||
MatchReleaseTypes: []string{"Album"},
|
||||
Artists: "Artiiiist",
|
||||
Sources: []string{"CD"},
|
||||
Media: []string{"CD"},
|
||||
Formats: []string{"FLAC"},
|
||||
Quality: []string{"24bit Lossless", "Lossless"},
|
||||
PerfectFlac: true,
|
||||
|
@ -1232,7 +1232,7 @@ func TestRelease_CheckFilter(t *testing.T) {
|
|||
MatchReleaseTypes: []string{"Album"},
|
||||
Artists: "Artist",
|
||||
Albums: "Albumname",
|
||||
Sources: []string{"CD"},
|
||||
Media: []string{"CD"},
|
||||
Formats: []string{"FLAC"},
|
||||
Quality: []string{"24bit Lossless", "Lossless"},
|
||||
PerfectFlac: true,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue