fix(releases): releasetags freeleech parsing (#306)

* refactor(releases): remove err from constructor

* fix(releases): freeleech parsing and filtering

* chore: remove unused releaseinfo package
This commit is contained in:
Ludvig Lundgren 2022-06-14 22:26:45 +02:00 committed by GitHub
parent fd3f10f95a
commit 6675a1df3e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 79 additions and 618 deletions

View file

@ -67,6 +67,7 @@ type Filter struct {
ExceptReleaseGroups string `json:"except_release_groups"`
Scene bool `json:"scene"`
Origins []string `json:"origins"`
Bonus []string `json:"bonus"`
Freeleech bool `json:"freeleech"`
FreeleechPercent string `json:"freeleech_percent"`
Shows string `json:"shows"`
@ -115,6 +116,10 @@ func (f Filter) CheckFilter(r *Release) ([]string, bool) {
return r.Rejections, false
}
if len(f.Bonus) > 0 && !sliceContainsSlice(r.Bonus, f.Bonus) {
r.addRejectionF("bonus not matching. got: %v want: %v", r.Bonus, f.Bonus)
}
if f.Freeleech && r.Freeleech != f.Freeleech {
r.addRejection("wanted: freeleech")
}
@ -575,15 +580,6 @@ func containsAnySlice(tags []string, filters []string) bool {
func checkFreeleechPercent(announcePercent int, filterPercent string) bool {
filters := strings.Split(filterPercent, ",")
// remove % and trim spaces
//announcePercent = strings.Replace(announcePercent, "%", "", -1)
//announcePercent = strings.Trim(announcePercent, " ")
//announcePercentInt, err := strconv.ParseInt(announcePercent, 10, 32)
//if err != nil {
// return false
//}
for _, s := range filters {
s = strings.Replace(s, "%", "", -1)
s = strings.Trim(s, " ")