updates: more web interface and scan fixes
Local Docker Build (Dev) / build-dev (push) Successful in 5s

This commit is contained in:
2025-11-03 14:38:21 -05:00
parent 04b2afdb19
commit 788b7e79f6
6 changed files with 31 additions and 11 deletions
+1 -1
View File
@@ -1 +1 @@
2.8.9-multiprocess-population 2.9.1-tmp-status-file
+2 -1
View File
@@ -15,7 +15,8 @@ from api.models import *
# Status file for cross-process communication # Status file for cross-process communication
POPULATE_STATUS_FILE = os.path.join(tempfile.gettempdir(), "nfoguard_populate_status.json") # Use /tmp which is writable in both core and web containers
POPULATE_STATUS_FILE = "/tmp/nfoguard_populate_status.json"
# Process tracking # Process tracking
_populate_process = None _populate_process = None
+7 -2
View File
@@ -238,6 +238,12 @@ class DatabasePopulator:
stats['skipped'] += 1 stats['skipped'] += 1
continue continue
# Only process episodes that have video files
has_file = episode.get('hasFile', False)
if not has_file:
stats['skipped'] += 1
continue
# Get air date # Get air date
aired = episode.get('airDate') aired = episode.get('airDate')
@@ -249,7 +255,7 @@ class DatabasePopulator:
if (season_num, episode_num) in bulk_import_dates: if (season_num, episode_num) in bulk_import_dates:
dateadded, source = bulk_import_dates[(season_num, episode_num)] dateadded, source = bulk_import_dates[(season_num, episode_num)]
# Fall back to API query # Fall back to API query
elif episode.get('hasFile'): else:
episode_id = episode.get('id') episode_id = episode.get('id')
if episode_id: if episode_id:
import_date = self.sonarr.get_episode_import_history(episode_id) import_date = self.sonarr.get_episode_import_history(episode_id)
@@ -267,7 +273,6 @@ class DatabasePopulator:
continue continue
# Insert into database # Insert into database
has_file = episode.get('hasFile', False)
self.db.upsert_episode_date(imdb_id, season_num, episode_num, aired, dateadded, source, has_file) self.db.upsert_episode_date(imdb_id, season_num, episode_num, aired, dateadded, source, has_file)
stats['added'] += 1 stats['added'] += 1
+1 -1
View File
@@ -33,7 +33,7 @@ def create_web_app() -> FastAPI:
app = FastAPI( app = FastAPI(
title="NFOGuard Web Interface", title="NFOGuard Web Interface",
description="Web interface for NFOGuard media database management", description="Web interface for NFOGuard media database management",
version="2.8.9-multiprocess-population", version="2.9.0-fixes-only-files",
docs_url="/docs" if web_config.web_debug else None, docs_url="/docs" if web_config.web_debug else None,
redoc_url="/redoc" if web_config.web_debug else None redoc_url="/redoc" if web_config.web_debug else None
) )
+2 -2
View File
@@ -29,7 +29,7 @@ def create_web_app() -> FastAPI:
app = FastAPI( app = FastAPI(
title="NFOGuard Web Interface", title="NFOGuard Web Interface",
description="Web interface for NFOGuard media database management", description="Web interface for NFOGuard media database management",
version="2.8.9-multiprocess-population", version="2.9.0-fixes-only-files",
docs_url=None, # Disable docs in production docs_url=None, # Disable docs in production
redoc_url=None redoc_url=None
) )
@@ -94,7 +94,7 @@ def setup_static_files(app: FastAPI) -> None:
"status": "healthy", "status": "healthy",
"service": "nfoguard-web", "service": "nfoguard-web",
"timestamp": time.time(), "timestamp": time.time(),
"version": "2.8.9-multiprocess-population" "version": "2.9.0-fixes-only-files"
} }
except Exception as e: except Exception as e:
from fastapi import HTTPException from fastapi import HTTPException
+18 -4
View File
@@ -96,19 +96,21 @@ def _setup_file_logging():
# Clear any existing handlers to avoid duplicates # Clear any existing handlers to avoid duplicates
logger.handlers.clear() logger.handlers.clear()
# Try to set up file logging
file_logging_enabled = False
try: try:
file_handler = SafeRotatingFileHandler( file_handler = SafeRotatingFileHandler(
log_dir / "nfoguard.log", maxBytes=50*1024*1024, backupCount=3 log_dir / "nfoguard.log", maxBytes=50*1024*1024, backupCount=3
) )
formatter = TimezoneAwareFormatter( formatter = TimezoneAwareFormatter(
'[%(asctime)s] %(levelname)s: %(message)s' '[%(asctime)s] %(levelname)s: %(message)s'
) )
file_handler.setFormatter(formatter) file_handler.setFormatter(formatter)
logger.addHandler(file_handler) logger.addHandler(file_handler)
file_logging_enabled = True
except Exception as e: except Exception as e:
# If RotatingFileHandler fails, fall back to regular FileHandler # If RotatingFileHandler fails, try regular FileHandler
print(f"Warning: Could not setup rotating file handler ({e}), using regular file handler")
try: try:
file_handler = logging.FileHandler(log_dir / "nfoguard.log") file_handler = logging.FileHandler(log_dir / "nfoguard.log")
formatter = TimezoneAwareFormatter( formatter = TimezoneAwareFormatter(
@@ -116,8 +118,20 @@ def _setup_file_logging():
) )
file_handler.setFormatter(formatter) file_handler.setFormatter(formatter)
logger.addHandler(file_handler) logger.addHandler(file_handler)
file_logging_enabled = True
except Exception as e2: except Exception as e2:
print(f"Error: Could not setup any file logging: {e2}") # File logging not available (e.g., read-only filesystem)
# Fall back to console-only logging silently
pass
# If file logging failed, ensure console handler is added
if not file_logging_enabled:
console_handler = logging.StreamHandler()
formatter = TimezoneAwareFormatter(
'[%(asctime)s] %(levelname)s: %(message)s'
)
console_handler.setFormatter(formatter)
logger.addHandler(console_handler)
return logger return logger