initial public release

This commit is contained in:
2026-07-06 11:05:50 -04:00
commit ca518c5f8a
94 changed files with 15699 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
package scan
import "strings"
// TitleMatcher returns true if a title should be kept.
type TitleMatcher func(title string) bool
// NewTitleMatcher builds a case-insensitive positive/negative matcher.
// At least one positive must match (or positives empty) AND zero negatives.
func NewTitleMatcher(f TitleFilter) TitleMatcher {
pos := lower(f.Positive)
neg := lower(f.Negative)
return func(title string) bool {
lt := strings.ToLower(title)
hasPos := len(pos) == 0
for _, p := range pos {
if strings.Contains(lt, p) {
hasPos = true
break
}
}
if !hasPos {
return false
}
for _, n := range neg {
if strings.Contains(lt, n) {
return false
}
}
return true
}
}
func lower(ss []string) []string {
out := make([]string, 0, len(ss))
for _, s := range ss {
out = append(out, strings.ToLower(s))
}
return out
}