diff --git a/CHANGELOG.md b/CHANGELOG.md index 975e7db..68acca5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/VERSION b/VERSION index c2c0004..449d7e7 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.3.5 +0.3.6 diff --git a/clients/radarr_client.py b/clients/radarr_client.py index 79c97bb..7c82b7a 100644 --- a/clients/radarr_client.py +++ b/clients/radarr_client.py @@ -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,18 +290,20 @@ class RadarrClient: event.get("sourcePath", "") or event.get("downloadPath", "")).lower() - if imported_path: - movie_imdb = (movie_info.get("imdbId", "") or "").lower() - movie_title = (movie_info.get("title", "") or "").lower() - movie_year = str(movie_info.get("year", "")) + if not imported_path: + continue - # First try IMDb ID match - if movie_imdb and ( - f"[imdb-{movie_imdb}]" in imported_path or - 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}") + movie_imdb = (movie_info.get("imdbId", "") or "").lower() + movie_title = (movie_info.get("title", "") or "").lower() + movie_year = str(movie_info.get("year", "")) + + # First try IMDb ID match + if movie_imdb and ( + f"[imdb-{movie_imdb}]" in imported_path or + f"[{movie_imdb}]" in imported_path or + movie_imdb in 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