diff --git a/nfoguard.py b/nfoguard.py index 14333ab..0482e8e 100644 --- a/nfoguard.py +++ b/nfoguard.py @@ -597,14 +597,27 @@ class MovieProcessor: def _get_digital_release_date(self, imdb_id: str) -> Tuple[Optional[str], str]: """Get release date from external sources using configured priority""" - release_result = self.external_clients.get_release_date_by_priority( - imdb_id, - config.release_date_priority, - enable_smart_validation=config.enable_smart_date_validation - ) - if release_result: - return release_result[0], release_result[1] - return None, "release:none" + _log("INFO", f"🔍 Calling external clients for {imdb_id}") + _log("INFO", f"Release date priority: {config.release_date_priority}") + _log("INFO", f"Smart validation enabled: {config.enable_smart_date_validation}") + + try: + release_result = self.external_clients.get_release_date_by_priority( + imdb_id, + config.release_date_priority, + enable_smart_validation=config.enable_smart_date_validation + ) + _log("INFO", f"External clients result for {imdb_id}: {release_result}") + + if release_result: + _log("INFO", f"✅ Got release date: {release_result[0]} from {release_result[1]}") + return release_result[0], release_result[1] + else: + _log("WARNING", f"❌ No release date found from external clients for {imdb_id}") + return None, "release:none" + except Exception as e: + _log("ERROR", f"External clients error for {imdb_id}: {e}") + return None, f"release:error:{str(e)}" def _get_file_mtime_date(self, movie_path: Path) -> Tuple[str, str, Optional[str]]: """Get date from file modification time as last resort""" @@ -1046,6 +1059,21 @@ async def debug_movie_import_date(imdb_id: str): # Use the global movie processor instance to test full decision logic global movie_processor if movie_processor: + # First check external clients configuration + _log("INFO", f"=== CHECKING EXTERNAL CLIENTS CONFIG ===") + try: + tmdb_key = os.environ.get("TMDB_API_KEY", "") + _log("INFO", f"TMDB API Key configured: {'✅ YES' if tmdb_key else '❌ NO'}") + if tmdb_key: + _log("INFO", f"TMDB API Key length: {len(tmdb_key)} chars") + + # Check if external clients exist + external_clients_available = hasattr(movie_processor, 'external_clients') and movie_processor.external_clients + _log("INFO", f"External clients initialized: {'✅ YES' if external_clients_available else '❌ NO'}") + + except Exception as e: + _log("ERROR", f"Error checking external clients config: {e}") + # Test the full decision logic (including TMDB fallback) final_date, final_source, released = movie_processor._decide_movie_dates( imdb_id, dummy_path, should_query=True, existing=None