diff --git a/internal/domain/filter.go b/internal/domain/filter.go index edba9ad..5dc5c83 100644 --- a/internal/domain/filter.go +++ b/internal/domain/filter.go @@ -319,13 +319,21 @@ func (f Filter) checkSizeFilter(r *Release, minSize string, maxSize string) bool return true } -func matchRegex(tag string, filter string) bool { - re, err := regexp.Compile(`(?i)(?:` + filter + `)`) - if err != nil { - return false +func matchRegex(tag string, filterList string) bool { + filters := strings.Split(filterList, ",") + + for _, filter := range filters { + re, err := regexp.Compile(`(?i)(?:` + filter + `)`) + if err != nil { + return false + } + match := re.MatchString(tag) + if match { + return true + } } - return re.MatchString(tag) + return false } // checkFilterIntStrings "1,2,3-20" diff --git a/internal/domain/filter_test.go b/internal/domain/filter_test.go index f5994b1..7dd875f 100644 --- a/internal/domain/filter_test.go +++ b/internal/domain/filter_test.go @@ -1598,6 +1598,8 @@ func Test_matchRegex(t *testing.T) { }{ {name: "test_1", args: args{tag: "Some.show.S01.DV.2160p.ATVP.WEB-DL.DDPA5.1.x265-GROUP1", filter: ".*2160p.+(group1|group2)"}, want: true}, {name: "test_2", args: args{tag: "Some.show.S01.DV.2160p.ATVP.WEB-DL.DDPA5.1.x265-GROUP2", filter: ".*1080p.+(group1|group3)"}, want: false}, + {name: "test_3", args: args{tag: "Some.show.S01.DV.2160p.ATVP.WEB-DL.DDPA5.1.x265-GROUP2", filter: ".*1080p.+(group1|group3),.*2160p.+"}, want: true}, + {name: "test_4", args: args{tag: "Some.show.S01.DV.2160p.ATVP.WEB-DL.DDPA5.1.x265-GROUP2", filter: ".*1080p.+(group1|group3),.*720p.+"}, want: false}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) {