feat: enrich RSS items without IDs via TMDB title search
Some checks failed
Build / build (push) Failing after 13m30s
Some checks failed
Build / build (push) Failing after 13m30s
Items from RSS feeds that have no media ID (tmdb/imdb/tvdb) are now enriched automatically using TMDB's search API. The release name is parsed to extract a clean title and year, then searched against TMDB to retrieve the TMDB ID before validation. - Add media/tmdb package with SearchMovies, SearchShows, and ExtractTitleAndYear (parses torrent release names) - Add EnrichFeedItemWithTmdbId to media.Client, called in rss/process.go before the ID validation switch - Add --run-now flag to nabarr run to trigger all feeds immediately - Wire media.Client through rss.Client and rssJob - Merge feature/add-tag-option (tag support for Sonarr/Radarr) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
25
media/tmdb/parse.go
Normal file
25
media/tmdb/parse.go
Normal file
@@ -0,0 +1,25 @@
|
||||
package tmdb
|
||||
|
||||
import (
|
||||
"regexp"
|
||||
"strconv"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var yearRegex = regexp.MustCompile(`\b(19|20)\d{2}\b`)
|
||||
|
||||
// ExtractTitleAndYear parses a torrent release name and returns the clean title and year.
|
||||
// Example: "The.Housemaid.2025.FRENCH.1080p" → ("The Housemaid", 2025)
|
||||
func ExtractTitleAndYear(releaseName string) (string, int) {
|
||||
s := strings.ReplaceAll(releaseName, ".", " ")
|
||||
s = strings.ReplaceAll(s, "_", " ")
|
||||
|
||||
loc := yearRegex.FindStringIndex(s)
|
||||
if loc == nil {
|
||||
return strings.TrimSpace(s), 0
|
||||
}
|
||||
|
||||
year, _ := strconv.Atoi(s[loc[0]:loc[1]])
|
||||
title := strings.TrimSpace(s[:loc[0]])
|
||||
return title, year
|
||||
}
|
||||
Reference in New Issue
Block a user