feat: Improved import detection and reduced debug noise
This commit is contained in:
@@ -4,6 +4,13 @@ All notable changes to this project will be documented in this file.
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [0.3.6] - 2025-09-08
|
||||
### Changed
|
||||
- Improved import detection filtering
|
||||
- Reduced debug noise for non-import events
|
||||
- Enhanced logging clarity for import matches
|
||||
- Added more context to import event messages
|
||||
|
||||
## [0.3.5] - 2025-09-08
|
||||
### Changed
|
||||
- Improved Radarr import detection to handle more cases
|
||||
|
||||
@@ -275,6 +275,9 @@ class RadarrClient:
|
||||
pass
|
||||
|
||||
# For import/download events, handle specially
|
||||
if event_type not in ["moviefileimported", "downloadFolderImported"]:
|
||||
continue
|
||||
|
||||
imported_path = None
|
||||
# Try different sources for the path
|
||||
if event_type == "moviefileimported":
|
||||
@@ -287,7 +290,9 @@ class RadarrClient:
|
||||
event.get("sourcePath", "") or
|
||||
event.get("downloadPath", "")).lower()
|
||||
|
||||
if imported_path:
|
||||
if not imported_path:
|
||||
continue
|
||||
|
||||
movie_imdb = (movie_info.get("imdbId", "") or "").lower()
|
||||
movie_title = (movie_info.get("title", "") or "").lower()
|
||||
movie_year = str(movie_info.get("year", ""))
|
||||
@@ -298,7 +303,7 @@ class RadarrClient:
|
||||
f"[{movie_imdb}]" in imported_path or
|
||||
movie_imdb in imported_path
|
||||
):
|
||||
_log("DEBUG", f"Found potential import event ({event_type}) matching IMDb {movie_imdb}: {imported_path}")
|
||||
_log("INFO", f"Found potential IMDb match in {event_type} event: {imported_path}")
|
||||
date_iso = datetime.fromisoformat(event["date"].replace("Z", "+00:00")).astimezone(timezone.utc).isoformat(timespec="seconds")
|
||||
_log("INFO", f"✅ FOUND IMPORT: exact IMDb match at {date_iso}")
|
||||
earliest_real_import = date_iso
|
||||
@@ -315,11 +320,11 @@ class RadarrClient:
|
||||
clean_title = clean_title.replace(f".{word}.", ".").replace(f"{word}.", "").replace(f".{word}", "")
|
||||
clean_path = clean_path.replace(f".{word}.", ".").replace(f"{word}.", "").replace(f".{word}", "")
|
||||
|
||||
# Look for both title and year
|
||||
# Look for both title and year in the path
|
||||
if clean_title in clean_path and movie_year in clean_path:
|
||||
_log("DEBUG", f"Found potential title/year match: {clean_title} ({movie_year}) in {clean_path}")
|
||||
date_iso = datetime.fromisoformat(event["date"].replace("Z", "+00:00")).astimezone(timezone.utc).isoformat(timespec="seconds")
|
||||
_log("INFO", f"✅ FOUND IMPORT: title/year match at {date_iso}")
|
||||
_log("INFO", f"Found potential title/year match in {event_type} event: {clean_title} ({movie_year})")
|
||||
_log("INFO", f"✅ FOUND IMPORT at {date_iso}")
|
||||
earliest_real_import = date_iso
|
||||
break
|
||||
|
||||
|
||||
Reference in New Issue
Block a user