mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 16:59:12 +00:00
fix(lists): improve parsing and exclude unwanted characters (#1918)
* fix(lists): improve parsing and ignore invalid titles * chore: add missing license headers * fix(lists): add missing tests from omegabrr
This commit is contained in:
parent
433c1248f4
commit
40c5462df9
18 changed files with 385 additions and 0 deletions
|
@ -1,3 +1,6 @@
|
|||
// Copyright (c) 2021 - 2024, Ludvig Lundgren and the autobrr contributors.
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
package list
|
||||
|
||||
import (
|
||||
|
@ -16,6 +19,7 @@ var (
|
|||
parenthesesEndRegexp = regexp.MustCompile(`\)$`)
|
||||
)
|
||||
|
||||
// yearRegexp = regexp.MustCompile(`\(\d{4}\)$`)
|
||||
func processTitle(title string, matchRelease bool) []string {
|
||||
// Checking if the title is empty.
|
||||
if strings.TrimSpace(title) == "" {
|
||||
|
@ -83,6 +87,10 @@ func NewTitleSlice() *Titles {
|
|||
}
|
||||
|
||||
func (ts *Titles) Add(title string, matchRelease bool) {
|
||||
if title == "" || title == "*" {
|
||||
return
|
||||
}
|
||||
|
||||
if matchRelease {
|
||||
title = strings.Trim(title, "?")
|
||||
title = fmt.Sprintf("*%v*", title)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue