fix: turn off hard coded debug

This commit is contained in:
2025-10-20 14:15:14 -04:00
parent 445206de4b
commit af779f9c59
4 changed files with 31 additions and 11 deletions
+10 -3
View File
@@ -29,6 +29,7 @@ class NFOGuardDatabase:
self.db_name = config.db_name
self.db_user = config.db_user
self.db_password = config.db_password
self.db_type = "postgresql" # NFOGuard uses PostgreSQL
self._local = threading.local()
self._init_database()
@@ -167,7 +168,9 @@ class NFOGuardDatabase:
has_video_file = EXCLUDED.has_video_file,
last_updated = EXCLUDED.last_updated
""", (imdb_id, season, episode, aired, dateadded, source, has_video_file, timestamp))
print(f"🔍 DEBUG: PostgreSQL upsert executed for {imdb_id} S{season:02d}E{episode:02d}, rows affected: {cursor.rowcount}")
import os
if os.environ.get("DEBUG", "false").lower() == "true":
print(f"🔍 DEBUG: PostgreSQL upsert executed for {imdb_id} S{season:02d}E{episode:02d}, rows affected: {cursor.rowcount}")
def upsert_movie(self, imdb_id: str, path: str):
"""Insert or update movie record"""
@@ -186,7 +189,9 @@ class NFOGuardDatabase:
def upsert_movie_dates(self, imdb_id: str, released: Optional[str],
dateadded: Optional[str], source: str, has_video_file: bool = False):
"""Insert or update movie date record"""
print(f"🔍 DATABASE UPSERT: imdb_id={imdb_id}, dateadded={dateadded}, source={source}")
import os
if os.environ.get("DEBUG", "false").lower() == "true":
print(f"🔍 DATABASE UPSERT: imdb_id={imdb_id}, dateadded={dateadded}, source={source}")
with self.get_connection() as conn:
cursor = conn.cursor()
timestamp = datetime.utcnow()
@@ -205,7 +210,9 @@ class NFOGuardDatabase:
# Debug: Check what was actually saved
cursor.execute("SELECT dateadded, source FROM movies WHERE imdb_id = %s", (imdb_id,))
result = cursor.fetchone()
print(f"🔍 DATABASE VERIFY: After upsert, found dateadded={result['dateadded'] if result else 'NOT_FOUND'}, source={result['source'] if result else 'NOT_FOUND'}")
import os
if os.environ.get("DEBUG", "false").lower() == "true":
print(f"🔍 DATABASE VERIFY: After upsert, found dateadded={result['dateadded'] if result else 'NOT_FOUND'}, source={result['source'] if result else 'NOT_FOUND'}")
def get_series_episodes(self, imdb_id: str, has_video_file_only: bool = False) -> List[Dict]:
"""Get all episodes for a series"""