mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
refactor(wildcard): optimize and add caching (#1634)
* fix(wildcard): avoid excessive allocations every loop * are you going to Scarborough Fair? * ruby ruby ruby ruby * ride on, little murphy * shirley? * to the moon * reggie are you there? * code 99 * my doctorate is in Art History * helps to be consistent * tidy * slow and steady gets the clam * oysters were better anyway * DIAL TONE
This commit is contained in:
parent
bc0f4cc055
commit
982f7ddf68
13 changed files with 177 additions and 60 deletions
|
@ -205,6 +205,8 @@ func (p IRCParserOrpheus) replaceSeparator(s string) string {
|
|||
return strings.ReplaceAll(s, "–", "-")
|
||||
}
|
||||
|
||||
var lastDecimalTag = regexp.MustCompile(`^\d{1,2}$|^100$`)
|
||||
|
||||
func (p IRCParserOrpheus) Parse(rls *Release, vars map[string]string) error {
|
||||
// OPS uses en-dashes as separators, which causes moistari/rls to not parse the torrentName properly,
|
||||
// we replace the en-dashes with hyphens here
|
||||
|
@ -219,7 +221,7 @@ func (p IRCParserOrpheus) Parse(rls *Release, vars map[string]string) error {
|
|||
// 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)
|
||||
match := lastDecimalTag.MatchString(lastTag)
|
||||
if match {
|
||||
splittedTags[len(splittedTags)-1] = lastTag + "%"
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue