updates: more web interface and scan fixes
Local Docker Build (Dev) / build-dev (push) Successful in 5s
Local Docker Build (Dev) / build-dev (push) Successful in 5s
This commit is contained in:
+2
-1
@@ -15,7 +15,8 @@ from api.models import *
|
||||
|
||||
|
||||
# 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
|
||||
_populate_process = None
|
||||
|
||||
@@ -238,6 +238,12 @@ class DatabasePopulator:
|
||||
stats['skipped'] += 1
|
||||
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
|
||||
aired = episode.get('airDate')
|
||||
|
||||
@@ -249,7 +255,7 @@ class DatabasePopulator:
|
||||
if (season_num, episode_num) in bulk_import_dates:
|
||||
dateadded, source = bulk_import_dates[(season_num, episode_num)]
|
||||
# Fall back to API query
|
||||
elif episode.get('hasFile'):
|
||||
else:
|
||||
episode_id = episode.get('id')
|
||||
if episode_id:
|
||||
import_date = self.sonarr.get_episode_import_history(episode_id)
|
||||
@@ -267,7 +273,6 @@ class DatabasePopulator:
|
||||
continue
|
||||
|
||||
# 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)
|
||||
stats['added'] += 1
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ def create_web_app() -> FastAPI:
|
||||
app = FastAPI(
|
||||
title="NFOGuard Web Interface",
|
||||
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,
|
||||
redoc_url="/redoc" if web_config.web_debug else None
|
||||
)
|
||||
|
||||
+2
-2
@@ -29,7 +29,7 @@ def create_web_app() -> FastAPI:
|
||||
app = FastAPI(
|
||||
title="NFOGuard Web Interface",
|
||||
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
|
||||
redoc_url=None
|
||||
)
|
||||
@@ -94,7 +94,7 @@ def setup_static_files(app: FastAPI) -> None:
|
||||
"status": "healthy",
|
||||
"service": "nfoguard-web",
|
||||
"timestamp": time.time(),
|
||||
"version": "2.8.9-multiprocess-population"
|
||||
"version": "2.9.0-fixes-only-files"
|
||||
}
|
||||
except Exception as e:
|
||||
from fastapi import HTTPException
|
||||
|
||||
+17
-3
@@ -96,6 +96,8 @@ def _setup_file_logging():
|
||||
# Clear any existing handlers to avoid duplicates
|
||||
logger.handlers.clear()
|
||||
|
||||
# Try to set up file logging
|
||||
file_logging_enabled = False
|
||||
try:
|
||||
file_handler = SafeRotatingFileHandler(
|
||||
log_dir / "nfoguard.log", maxBytes=50*1024*1024, backupCount=3
|
||||
@@ -106,9 +108,9 @@ def _setup_file_logging():
|
||||
)
|
||||
file_handler.setFormatter(formatter)
|
||||
logger.addHandler(file_handler)
|
||||
file_logging_enabled = True
|
||||
except Exception as e:
|
||||
# If RotatingFileHandler fails, fall back to regular FileHandler
|
||||
print(f"Warning: Could not setup rotating file handler ({e}), using regular file handler")
|
||||
# If RotatingFileHandler fails, try regular FileHandler
|
||||
try:
|
||||
file_handler = logging.FileHandler(log_dir / "nfoguard.log")
|
||||
formatter = TimezoneAwareFormatter(
|
||||
@@ -116,8 +118,20 @@ def _setup_file_logging():
|
||||
)
|
||||
file_handler.setFormatter(formatter)
|
||||
logger.addHandler(file_handler)
|
||||
file_logging_enabled = True
|
||||
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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user