chg: fix: year detection algorithim

This commit is contained in:
2024-03-10 12:48:48 +00:00
parent bfe26c91e3
commit b1cece2743
2 changed files with 24 additions and 18 deletions

View File

@@ -159,7 +159,10 @@ func getTorrents(ctx context.Context, i *Indexer, link string) ([]IndexedTorrent
text := s.Text()
audio = append(audio, findAudioFromText(text)...)
year = findYearFromText(text, title)
y := findYearFromText(text, title)
if y != "" {
year = y
}
size = append(size, findSizesFromText(text)...)
})
@@ -283,6 +286,9 @@ func findYearFromText(text string, title string) (year string) {
}
if year == "" {
fmt.Println("DEBUG: year not found in text, trying to find in title")
fmt.Println("DEBUG: title:", title)
fmt.Println("DEBUG: text:", text)
re = regexp.MustCompile(`\((\d{4})\)`)
yearMatch := re.FindStringSubmatch(title)
if len(yearMatch) > 0 {