From d501c4364cf44594cbf4bb1e2605c127cf0ffe93 Mon Sep 17 00:00:00 2001 From: SBCrumb Date: Mon, 3 Nov 2025 20:40:42 -0500 Subject: [PATCH] update to tv --- VERSION | 2 +- api/web_routes.py | 16 ++++++++++------ core/database_populator.py | 10 ++++++---- nfoguard-web/static/index.html | 10 +++++++--- nfoguard-web/static/js/app.js | 7 ++++--- 5 files changed, 28 insertions(+), 17 deletions(-) diff --git a/VERSION b/VERSION index 00e9aca..9fe31a5 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.10.0-skipped-tracking-fix3 +2.10.0-skipped-tracking-v5 diff --git a/api/web_routes.py b/api/web_routes.py index cd24973..df0be48 100644 --- a/api/web_routes.py +++ b/api/web_routes.py @@ -177,8 +177,8 @@ async def get_tv_series_list(dependencies: dict, db = dependencies["db"] # Validate date_filter values - if date_filter and date_filter not in ['complete', 'incomplete', 'none']: - raise HTTPException(status_code=422, detail=f"Invalid date_filter: must be 'complete', 'incomplete', or 'none', got '{date_filter}'") + if date_filter and date_filter not in ['complete', 'incomplete', 'none', 'skipped']: + raise HTTPException(status_code=422, detail=f"Invalid date_filter: must be 'complete', 'incomplete', 'none', or 'skipped', got '{date_filter}'") with db.get_connection() as conn: cursor = conn.cursor() @@ -211,6 +211,9 @@ async def get_tv_series_list(dependencies: dict, elif date_filter == "none": # No episodes have dates having_conditions.append("COUNT(e.episode) > 0 AND COUNT(CASE WHEN e.dateadded IS NOT NULL THEN 1 END) = 0") + elif date_filter == "skipped": + # Has skipped episodes + having_conditions.append("COUNT(CASE WHEN e.skipped = TRUE THEN 1 END) > 0") where_clause = " AND ".join(where_conditions) if where_conditions else "1=1" having_clause = " AND ".join(having_conditions) if having_conditions else "" @@ -242,13 +245,14 @@ async def get_tv_series_list(dependencies: dict, having_part = f" HAVING {having_clause}" if having_clause else "" # PostgreSQL query query = f""" - SELECT - s.imdb_id, - s.path, + SELECT + s.imdb_id, + s.path, s.last_updated, COUNT(e.episode) as total_episodes, COUNT(CASE WHEN e.dateadded IS NOT NULL THEN 1 END) as episodes_with_dates, - COUNT(CASE WHEN e.has_video_file = TRUE THEN 1 END) as episodes_with_video + COUNT(CASE WHEN e.has_video_file = TRUE THEN 1 END) as episodes_with_video, + COUNT(CASE WHEN e.skipped = TRUE THEN 1 END) as episodes_skipped FROM series s LEFT JOIN episodes e ON s.imdb_id = e.imdb_id WHERE {where_clause} diff --git a/core/database_populator.py b/core/database_populator.py index 2bac515..9bc13e3 100644 --- a/core/database_populator.py +++ b/core/database_populator.py @@ -261,14 +261,16 @@ class DatabasePopulator: for series in all_series: try: imdb_id = series.get('imdbId') - if not imdb_id: - _log("DEBUG", f"Skipping series without IMDb ID: {series.get('title')}") - continue - series_id = series.get('id') series_path = series.get('path', '') series_title = series.get('title', 'Unknown') + if not imdb_id: + # Generate placeholder IMDb ID using hash of path + path_hash = hashlib.md5(series_path.encode()).hexdigest()[:12] + imdb_id = f"missing-{path_hash}" + _log("DEBUG", f"Series without IMDb ID: {series_title} (path: {series_path}), using placeholder {imdb_id}") + # Update series record self.db.upsert_series(imdb_id, series_path) diff --git a/nfoguard-web/static/index.html b/nfoguard-web/static/index.html index b9d626a..c50f043 100644 --- a/nfoguard-web/static/index.html +++ b/nfoguard-web/static/index.html @@ -4,7 +4,7 @@ NFOGuard - Database Management - + @@ -12,7 +12,7 @@
-

NFOGuard v2.10.0-skipped-tracking-fix3

+

NFOGuard v2.10.0-skipped-tracking-v5

Database Management & Reporting