diff --git a/CHANGELOG.md b/CHANGELOG.md index 83546f09..985aab37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed +- Fixed VOD refresh failures caused by orphaned logo references: Added validation to detect and clear logo foreign key references when the logo no longer exists in the database, preventing "VODLogo matching query does not exist" errors. Also improved logo assignment logic to properly handle cases where logo URLs exist but logo creation fails, ensuring VOD content updates successfully even when logos are deleted or unavailable. - Fixed channel profile filtering to properly restrict content based on assigned channel profiles for all non-admin users (user_level < 10) instead of only streamers (user_level == 0). This corrects the XtreamCodes API endpoints (`get_live_categories` and `get_live_streams`) along with M3U and EPG generation, ensuring standard users (level 1) are properly restricted by their assigned channel profiles. Previously, "Standard" users with channel profiles assigned would see all channels instead of only those in their assigned profiles. - Fixed NumPy baseline detection in Docker entrypoint. Now calls `numpy.show_config()` directly with case-insensitive grep instead of incorrectly wrapping the output. - Fixed SettingsUtils frontend tests for new grouped settings architecture. Updated test suite to properly verify grouped JSON settings (stream_settings, dvr_settings, etc.) instead of individual CharField settings, including tests for type conversions, array-to-CSV transformations, and special handling of proxy_settings and network_access. diff --git a/apps/vod/tasks.py b/apps/vod/tasks.py index 0dcd9cfd..b0c66434 100644 --- a/apps/vod/tasks.py +++ b/apps/vod/tasks.py @@ -555,10 +555,17 @@ def process_movie_batch(account, batch, categories, relations, scan_start_time=N # Handle logo assignment for existing movies logo_updated = False - if logo_url and len(logo_url) <= 500 and logo_url in existing_logos: - new_logo = existing_logos[logo_url] - if movie.logo != new_logo: - movie._logo_to_update = new_logo + if logo_url and len(logo_url) <= 500: + if logo_url in existing_logos: + new_logo = existing_logos[logo_url] + if movie.logo != new_logo: + movie._logo_to_update = new_logo + logo_updated = True + elif movie.logo: + # Logo URL exists but logo creation failed or logo not found + # Clear the orphaned logo reference + logger.warning(f"Logo URL provided but logo not found in database for movie '{movie.name}', clearing logo reference") + movie._logo_to_update = None logo_updated = True elif (not logo_url or len(logo_url) > 500) and movie.logo: # Clear logo if no logo URL provided or URL is too long @@ -662,6 +669,8 @@ def process_movie_batch(account, batch, categories, relations, scan_start_time=N for movie in movies_to_update: if hasattr(movie, '_logo_to_update'): movie.logo = movie._logo_to_update + # Validate logo reference exists before saving + validate_logo_reference(movie, "Movie") movie.save(update_fields=['logo']) # Update relations to reference the correct movie objects (with PKs) @@ -905,10 +914,17 @@ def process_series_batch(account, batch, categories, relations, scan_start_time= # Handle logo assignment for existing series logo_updated = False - if logo_url and len(logo_url) <= 500 and logo_url in existing_logos: - new_logo = existing_logos[logo_url] - if series.logo != new_logo: - series._logo_to_update = new_logo + if logo_url and len(logo_url) <= 500: + if logo_url in existing_logos: + new_logo = existing_logos[logo_url] + if series.logo != new_logo: + series._logo_to_update = new_logo + logo_updated = True + elif series.logo: + # Logo URL exists but logo creation failed or logo not found + # Clear the orphaned logo reference + logger.warning(f"Logo URL provided but logo not found in database for series '{series.name}', clearing logo reference") + series._logo_to_update = None logo_updated = True elif (not logo_url or len(logo_url) > 500) and series.logo: # Clear logo if no logo URL provided or URL is too long @@ -1012,6 +1028,8 @@ def process_series_batch(account, batch, categories, relations, scan_start_time= for series in series_to_update: if hasattr(series, '_logo_to_update'): series.logo = series._logo_to_update + # Validate logo reference exists before saving + validate_logo_reference(series, "Series") series.save(update_fields=['logo']) # Update relations to reference the correct series objects (with PKs)