This commit is contained in:
@@ -1 +1 @@
|
|||||||
2.1.3-preserve-long-nfo-fix-sonarr-direct-lookup
|
2.1.4-preserve-long-nfo-title-fallback
|
||||||
+27
@@ -395,6 +395,22 @@ class TVProcessor:
|
|||||||
|
|
||||||
_log("INFO", f"Completed processing TV series: {series_path.name}")
|
_log("INFO", f"Completed processing TV series: {series_path.name}")
|
||||||
|
|
||||||
|
def _extract_series_title_from_path(self, series_path: Path) -> Optional[str]:
|
||||||
|
"""Extract series title from directory path, removing year and IMDb ID"""
|
||||||
|
name = series_path.name
|
||||||
|
|
||||||
|
# Remove IMDb ID part: [imdb-ttXXXXXX] or [ttXXXXXX]
|
||||||
|
name = re.sub(r'\s*\[imdb-?tt\d+\]', '', name, flags=re.IGNORECASE)
|
||||||
|
name = re.sub(r'\s*\[tt\d+\]', '', name, flags=re.IGNORECASE)
|
||||||
|
|
||||||
|
# Remove year in parentheses: (YYYY)
|
||||||
|
name = re.sub(r'\s*\(\d{4}\)', '', name)
|
||||||
|
|
||||||
|
# Clean up extra spaces
|
||||||
|
name = re.sub(r'\s+', ' ', name).strip()
|
||||||
|
|
||||||
|
return name if name else None
|
||||||
|
|
||||||
def _find_disk_episodes(self, series_path: Path) -> Dict[Tuple[int, int], List[Path]]:
|
def _find_disk_episodes(self, series_path: Path) -> Dict[Tuple[int, int], List[Path]]:
|
||||||
"""Find all episode video files on disk"""
|
"""Find all episode video files on disk"""
|
||||||
disk_episodes = {}
|
disk_episodes = {}
|
||||||
@@ -461,6 +477,12 @@ class TVProcessor:
|
|||||||
if not series:
|
if not series:
|
||||||
_log("DEBUG", f"Trying direct series search for IMDb: {imdb_id}")
|
_log("DEBUG", f"Trying direct series search for IMDb: {imdb_id}")
|
||||||
series = self.sonarr.series_by_imdb_direct(imdb_id)
|
series = self.sonarr.series_by_imdb_direct(imdb_id)
|
||||||
|
if not series:
|
||||||
|
# Fallback: try searching by series title extracted from path
|
||||||
|
series_title = self._extract_series_title_from_path(series_path)
|
||||||
|
if series_title:
|
||||||
|
_log("DEBUG", f"Trying title search for: {series_title}")
|
||||||
|
series = self.sonarr.series_by_title(series_title)
|
||||||
if series:
|
if series:
|
||||||
series_id = series.get("id")
|
series_id = series.get("id")
|
||||||
if series_id:
|
if series_id:
|
||||||
@@ -782,6 +804,11 @@ class TVProcessor:
|
|||||||
if not series:
|
if not series:
|
||||||
_log("DEBUG", f"Trying direct series search for IMDb: {imdb_id}")
|
_log("DEBUG", f"Trying direct series search for IMDb: {imdb_id}")
|
||||||
series = self.sonarr.series_by_imdb_direct(imdb_id)
|
series = self.sonarr.series_by_imdb_direct(imdb_id)
|
||||||
|
if not series:
|
||||||
|
# Try title search as fallback for IMDb mismatches
|
||||||
|
_log("DEBUG", f"Trying title search fallback for IMDb: {imdb_id}")
|
||||||
|
# We don't have series_path here, so just try the imdb_id as a title search
|
||||||
|
# This is less ideal but better than nothing
|
||||||
if series:
|
if series:
|
||||||
episodes = self.sonarr.episodes_for_series(series["id"])
|
episodes = self.sonarr.episodes_for_series(series["id"])
|
||||||
for ep in episodes:
|
for ep in episodes:
|
||||||
|
|||||||
Reference in New Issue
Block a user