mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
feat(releases): set freeleech percent 100 with freeleech bool (#872)
* feat(releases): set freeleech to freeleech percent 100 * fix(releases): check if freeleechpercent is gt 0
This commit is contained in:
parent
7cbcc2e14c
commit
956bccd69f
2 changed files with 41 additions and 35 deletions
|
@ -546,6 +546,8 @@ func (r *Release) MapVars(def *IndexerDefinition, varMap map[string]string) erro
|
|||
fl := StringEqualFoldMulti(freeleech, "freeleech", "yes", "1", "VIP")
|
||||
if fl {
|
||||
r.Freeleech = true
|
||||
// default to 100 and override if freeleechPercent is present in next function
|
||||
r.FreeleechPercent = 100
|
||||
r.Bonus = append(r.Bonus, "Freeleech")
|
||||
}
|
||||
}
|
||||
|
@ -560,6 +562,7 @@ func (r *Release) MapVars(def *IndexerDefinition, varMap map[string]string) erro
|
|||
//log.Debug().Msgf("bad freeleechPercent var: %v", year)
|
||||
}
|
||||
|
||||
if (freeleechPercentInt > 0) {
|
||||
r.Freeleech = true
|
||||
r.FreeleechPercent = freeleechPercentInt
|
||||
|
||||
|
@ -575,7 +578,7 @@ func (r *Release) MapVars(def *IndexerDefinition, varMap map[string]string) erro
|
|||
case 100:
|
||||
r.Bonus = append(r.Bonus, "Freeleech100")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if uploader, err := getStringMapValue(varMap, "uploader"); err == nil {
|
||||
|
|
|
@ -300,6 +300,7 @@ func TestRelease_MapVars(t *testing.T) {
|
|||
TorrentName: "Good show S02 2160p ATVP WEB-DL DDP 5.1 Atmos DV HEVC-GROUP2",
|
||||
Category: "tv",
|
||||
Freeleech: true,
|
||||
FreeleechPercent: 100,
|
||||
Bonus: []string{"Freeleech"},
|
||||
Uploader: "Anon",
|
||||
Size: uint64(10000000000),
|
||||
|
@ -481,6 +482,7 @@ func TestRelease_MapVars(t *testing.T) {
|
|||
Tags: []string{"comedy", "fantasy", "school.life", "shounen", "slice.of.life"},
|
||||
Uploader: "Tester",
|
||||
Freeleech: true,
|
||||
FreeleechPercent: 100,
|
||||
Bonus: []string{"Freeleech"},
|
||||
},
|
||||
args: args{varMap: map[string]string{
|
||||
|
@ -499,6 +501,7 @@ func TestRelease_MapVars(t *testing.T) {
|
|||
TorrentName: "Good show S02 2160p ATVP WEB-DL DDP 5.1 Atmos DV HEVC-GROUP2",
|
||||
Category: "tv",
|
||||
Freeleech: true,
|
||||
FreeleechPercent: 100,
|
||||
Bonus: []string{"Freeleech"},
|
||||
Uploader: "Anon",
|
||||
Size: uint64(10000000000),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue