mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
fix(indexers): OPS log score parsing (#1592)
* fix(parsing): OPS Missing % The message from OPS Announce does not contain a % sign and that seemed to break it. This is probably not the best fix but it is something. * fix(parsing): Join Tags and Remove Unnecessary Char Replacement Forgot to join tags before parsing, and removed an unnecessary char replacement that was not needed. * fix(parsing): Added Regex for 0-100 I forgot to check for all score values, also added the regex import * feat: add test cases for OPS log score parsing --------- Co-authored-by: ze0s <ze0s@riseup.net>
This commit is contained in:
parent
3cb18b013f
commit
8f995006b1
2 changed files with 56 additions and 1 deletions
|
@ -7,6 +7,7 @@ import (
|
|||
"context"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
@ -207,6 +208,20 @@ func (p IRCParserOrpheus) Parse(rls *Release, vars map[string]string) error {
|
|||
year := vars["year"]
|
||||
releaseTagsString := vars["releaseTags"]
|
||||
|
||||
splittedTags := strings.Split(releaseTagsString, "/")
|
||||
|
||||
// Check and replace the last tag if it's a number between 0 and 100
|
||||
if len(splittedTags) > 0 {
|
||||
lastTag := splittedTags[len(splittedTags)-1]
|
||||
match, _ := regexp.MatchString(`^\d{1,2}$|^100$`, lastTag)
|
||||
if match {
|
||||
splittedTags[len(splittedTags)-1] = lastTag + "%"
|
||||
}
|
||||
}
|
||||
|
||||
// Join tags back into a string
|
||||
releaseTagsString = strings.Join(splittedTags, " ")
|
||||
|
||||
//cleanTags := strings.ReplaceAll(releaseTagsString, "/", " ")
|
||||
cleanTags := CleanReleaseTags(releaseTagsString)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue