mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 00:39:13 +00:00
feat(filters): implement AnnounceType
(#1837)
* feat(filters): implement AnnounceType * fix: rss tests
This commit is contained in:
parent
ec85d53d8f
commit
f644b3a4d6
12 changed files with 155 additions and 17 deletions
|
@ -107,6 +107,7 @@ type Filter struct {
|
|||
UseRegex bool `json:"use_regex,omitempty"`
|
||||
MatchReleaseGroups string `json:"match_release_groups,omitempty"`
|
||||
ExceptReleaseGroups string `json:"except_release_groups,omitempty"`
|
||||
AnnounceTypes []string `json:"announce_types,omitempty"`
|
||||
Scene bool `json:"scene,omitempty"`
|
||||
Origins []string `json:"origins,omitempty"`
|
||||
ExceptOrigins []string `json:"except_origins,omitempty"`
|
||||
|
@ -222,6 +223,7 @@ type FilterUpdate struct {
|
|||
MaxSize *string `json:"max_size,omitempty"`
|
||||
Delay *int `json:"delay,omitempty"`
|
||||
Priority *int32 `json:"priority,omitempty"`
|
||||
AnnounceTypes *[]string `json:"announce_types,omitempty"`
|
||||
MaxDownloads *int `json:"max_downloads,omitempty"`
|
||||
MaxDownloadsUnit *FilterMaxDownloadsUnit `json:"max_downloads_unit,omitempty"`
|
||||
MatchReleases *string `json:"match_releases,omitempty"`
|
||||
|
@ -385,6 +387,10 @@ func (f *Filter) CheckFilter(r *Release) (*RejectionReasons, bool) {
|
|||
f.RejectReasons.Add("freeleech percent", r.FreeleechPercent, f.FreeleechPercent)
|
||||
}
|
||||
|
||||
if len(f.AnnounceTypes) > 0 && !basicContainsSlice(string(r.AnnounceType), f.AnnounceTypes) {
|
||||
f.RejectReasons.Add("match announce type", r.AnnounceType, f.AnnounceTypes)
|
||||
}
|
||||
|
||||
if len(f.Origins) > 0 && !containsSlice(r.Origin, f.Origins) {
|
||||
f.RejectReasons.Add("match origin", r.Origin, f.Origins)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue