mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
feat(filters): improve rejection handling (#1776)
* feat(filters): improve rejection handling * fix(filters): rejection tests * fix(filters): size check error rejection
This commit is contained in:
parent
ae779e5461
commit
f029de233f
8 changed files with 586 additions and 311 deletions
|
@ -620,35 +620,6 @@ func (r *Release) HasMagnetUri() bool {
|
|||
|
||||
const MagnetURIPrefix = "magnet:?"
|
||||
|
||||
func (r *Release) addRejection(reason string) {
|
||||
r.Rejections = append(r.Rejections, reason)
|
||||
}
|
||||
|
||||
func (r *Release) AddRejectionF(format string, v ...interface{}) {
|
||||
r.addRejectionF(format, v...)
|
||||
}
|
||||
|
||||
func (r *Release) addRejectionF(format string, v ...interface{}) {
|
||||
r.Rejections = append(r.Rejections, fmt.Sprintf(format, v...))
|
||||
}
|
||||
|
||||
// ResetRejections reset rejections between filter checks
|
||||
func (r *Release) resetRejections() {
|
||||
r.Rejections = []string{}
|
||||
}
|
||||
|
||||
func (r *Release) RejectionsString(trim bool) string {
|
||||
if len(r.Rejections) > 0 {
|
||||
out := strings.Join(r.Rejections, ", ")
|
||||
if trim && len(out) > 1024 {
|
||||
out = out[:1024]
|
||||
}
|
||||
|
||||
return out
|
||||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
// MapVars map vars from regex captures to fields on release
|
||||
func (r *Release) MapVars(def *IndexerDefinition, varMap map[string]string) error {
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue