mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
feat(indexers): BHD freeleech announces (#1216)
* feat(indexers): BHD freeleech announces * feat: parse and map bhd freeleech --------- Co-authored-by: ze0s <ze0s@riseup.net>
This commit is contained in:
parent
c866f167f7
commit
d1fa1b7cdf
2 changed files with 16 additions and 3 deletions
|
@ -656,7 +656,7 @@ func (r *Release) MapVars(def *IndexerDefinition, varMap map[string]string) erro
|
|||
}
|
||||
|
||||
if freeleech, err := getStringMapValue(varMap, "freeleech"); err == nil {
|
||||
fl := StringEqualFoldMulti(freeleech, "freeleech", "yes", "1", "VIP")
|
||||
fl := StringEqualFoldMulti(freeleech, "freeleech", "freeleech!", "yes", "1", "VIP")
|
||||
if fl {
|
||||
r.Freeleech = true
|
||||
// default to 100 and override if freeleechPercent is present in next function
|
||||
|
@ -666,6 +666,15 @@ func (r *Release) MapVars(def *IndexerDefinition, varMap map[string]string) erro
|
|||
}
|
||||
|
||||
if freeleechPercent, err := getStringMapValue(varMap, "freeleechPercent"); err == nil {
|
||||
// special handling for BHD to map their freeleech into percent
|
||||
if def.Identifier == "beyondhd" {
|
||||
if freeleechPercent == "Capped FL" {
|
||||
freeleechPercent = "100%"
|
||||
} else if strings.Contains(freeleechPercent, "% FL") {
|
||||
freeleechPercent = strings.Replace(freeleechPercent, " FL", "", -1)
|
||||
}
|
||||
}
|
||||
|
||||
// remove % and trim spaces
|
||||
freeleechPercent = strings.Replace(freeleechPercent, "%", "", -1)
|
||||
freeleechPercent = strings.Trim(freeleechPercent, " ")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue