fix(indexers): BTFiles size parsing (#1805)

* fix(indexers): btfiles size

* fix: revert btfiles definition tests

* fix(release): strip comma of torrentSize string before parse

---------

Co-authored-by: ze0s <43699394+zze0s@users.noreply.github.com>
This commit is contained in:
Kyle Sanderson 2024-11-06 05:13:27 -08:00 committed by GitHub
parent 594393eaaf
commit f4c2aef38c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -690,6 +690,9 @@ func (r *Release) MapVars(def *IndexerDefinition, varMap map[string]string) erro
}
if torrentSize, err := getStringMapValue(varMap, "torrentSize"); err == nil {
// Some indexers like BTFiles announces size with comma. Humanize does not handle that well and strips it.
torrentSize = strings.Replace(torrentSize, ",", ".", 1)
// handling for indexer who doesn't explicitly set which size unit is used like (AR)
if def.IRC != nil && def.IRC.Parse != nil && def.IRC.Parse.ForceSizeUnit != "" {
torrentSize = fmt.Sprintf("%s %s", torrentSize, def.IRC.Parse.ForceSizeUnit)