update to skiped files
Local Docker Build (Dev) / build-dev (push) Successful in 5s

This commit is contained in:
2025-11-03 16:37:42 -05:00
parent c9b099a218
commit 7932b9cfba
6 changed files with 209 additions and 54 deletions
+33 -14
View File
@@ -82,13 +82,14 @@ def map_source_to_description(source: str) -> str:
# Database Query Endpoints
# ---------------------------
async def get_movies_list(dependencies: dict,
async def get_movies_list(dependencies: dict,
skip: int = Query(0, ge=0),
limit: int = Query(100, le=1000),
has_date: Optional[bool] = Query(None),
source_filter: Optional[str] = Query(None),
search: Optional[str] = Query(None),
imdb_search: Optional[str] = Query(None)):
imdb_search: Optional[str] = Query(None),
skipped: Optional[bool] = Query(None)):
"""Get paginated list of movies with filtering options"""
db = dependencies["db"]
@@ -98,7 +99,13 @@ async def get_movies_list(dependencies: dict,
# Build dynamic query
where_conditions = []
params = []
if skipped is not None:
if skipped:
where_conditions.append("skipped = TRUE")
else:
where_conditions.append("(skipped = FALSE OR skipped IS NULL)")
if has_date is not None:
if has_date:
# PostgreSQL - NULL handling
@@ -106,15 +113,15 @@ async def get_movies_list(dependencies: dict,
else:
# PostgreSQL - NULL handling
where_conditions.append("dateadded IS NULL")
if source_filter:
where_conditions.append("source = %s")
params.append(source_filter)
if search:
where_conditions.append("(imdb_id ILIKE %s OR path ILIKE %s)")
params.extend([f"%{search}%", f"%{search}%"])
where_conditions.append("(imdb_id ILIKE %s OR path ILIKE %s OR title ILIKE %s)")
params.extend([f"%{search}%", f"%{search}%", f"%{search}%"])
if imdb_search:
where_conditions.append("imdb_id ILIKE %s")
params.append(f"%{imdb_search}%")
@@ -128,7 +135,7 @@ async def get_movies_list(dependencies: dict,
# Get paginated results - PostgreSQL
query = f"""
SELECT imdb_id, title, year, path, released, dateadded, source, has_video_file, last_updated
SELECT imdb_id, title, year, path, released, dateadded, source, has_video_file, last_updated, skipped, skip_reason
FROM movies
WHERE {where_clause}
ORDER BY last_updated DESC
@@ -488,7 +495,14 @@ async def get_dashboard_stats(dependencies: dict):
cursor.execute("SELECT COUNT(*) FROM episodes WHERE source = 'no_valid_date_source'")
episodes_no_valid_source = db._get_first_value(cursor.fetchone())
# Skipped items
cursor.execute("SELECT COUNT(*) FROM movies WHERE skipped = TRUE")
movies_skipped = db._get_first_value(cursor.fetchone())
cursor.execute("SELECT COUNT(*) FROM episodes WHERE skipped = TRUE")
episodes_skipped = db._get_first_value(cursor.fetchone())
# Recent activity (last 7 days)
cursor.execute("""
SELECT COUNT(*) FROM processing_history
@@ -518,7 +532,8 @@ async def get_dashboard_stats(dependencies: dict):
# Calculate total missing dates (movies + episodes)
total_missing_dates = movies_without_dates + episodes_without_dates
total_skipped = movies_skipped + episodes_skipped
# Combine with enhanced stats
stats.update({
"movies_with_dates": movies_with_dates,
@@ -530,6 +545,9 @@ async def get_dashboard_stats(dependencies: dict):
"total_missing_dates": total_missing_dates,
"movies_no_valid_source": movies_no_valid_source,
"episodes_no_valid_source": episodes_no_valid_source,
"movies_skipped": movies_skipped,
"episodes_skipped": episodes_skipped,
"total_skipped": total_skipped,
"recent_activity_count": recent_activity,
"movie_sources": movie_sources,
"episode_sources": episode_sources
@@ -1461,9 +1479,10 @@ def register_web_routes(app, dependencies):
# Movies endpoints
@app.get("/api/movies")
async def api_movies_list(skip: int = 0, limit: int = 100, has_date: bool = None,
source_filter: str = None, search: str = None, imdb_search: str = None):
return await get_movies_list(dependencies, skip, limit, has_date, source_filter, search, imdb_search)
async def api_movies_list(skip: int = 0, limit: int = 100, has_date: bool = None,
source_filter: str = None, search: str = None, imdb_search: str = None,
skipped: bool = None):
return await get_movies_list(dependencies, skip, limit, has_date, source_filter, search, imdb_search, skipped)
@app.post("/api/movies/{imdb_id}/update-date")
async def api_update_movie_date(imdb_id: str, dateadded: str = None, source: str = "manual"):