mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-01-23 02:35:14 +00:00
Merge pull request #796 from patchy8736:dev
Some checks are pending
CI Pipeline / prepare (push) Waiting to run
CI Pipeline / docker (amd64, ubuntu-24.04) (push) Blocked by required conditions
CI Pipeline / docker (arm64, ubuntu-24.04-arm) (push) Blocked by required conditions
CI Pipeline / create-manifest (push) Blocked by required conditions
Build and Push Multi-Arch Docker Image / build-and-push (push) Waiting to run
Some checks are pending
CI Pipeline / prepare (push) Waiting to run
CI Pipeline / docker (amd64, ubuntu-24.04) (push) Blocked by required conditions
CI Pipeline / docker (arm64, ubuntu-24.04-arm) (push) Blocked by required conditions
CI Pipeline / create-manifest (push) Blocked by required conditions
Build and Push Multi-Arch Docker Image / build-and-push (push) Waiting to run
Fix episode processing issues in VOD tasks (#770)
This commit is contained in:
commit
a363d9f0e6
2 changed files with 30 additions and 4 deletions
|
|
@ -32,7 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Removed unused Dashboard and Home pages
|
||||
- Logo loading optimization: Logos now load only after both Channels and Streams tables complete loading to prevent blocking initial page render, with rendering gated by table readiness to ensure data loads before visual elements
|
||||
- M3U stream URLs now use `build_absolute_uri_with_port()` for consistency with EPG and logo URLs, ensuring uniform port handling across all M3U file URLs
|
||||
- Settings and Logos page refactoring for improved readability and separation of concerns - Thanks [@nick4810](https://github.com/nick4810) (PR #795)
|
||||
- Settings and Logos page refactoring for improved readability and separation of concerns - Thanks [@nick4810](https://github.com/nick4810)
|
||||
- Extracted individual settings forms (DVR, Network Access, Proxy, Stream, System, UI) into separate components with dedicated utility files
|
||||
- Moved larger nested components into their own files
|
||||
- Moved business logic into corresponding utils/ files
|
||||
|
|
@ -41,6 +41,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
|
||||
### Fixed
|
||||
|
||||
- VOD episode processing now properly handles season and episode numbers from APIs that return string values instead of integers, with comprehensive error logging to track data quality issues - Thanks [@patchy8736](https://github.com/patchy8736) (Fixes #770)
|
||||
- VOD episode-to-stream relations are now validated to ensure episodes have been saved to the database before creating relations, preventing integrity errors when bulk_create operations encounter conflicts - Thanks [@patchy8736](https://github.com/patchy8736)
|
||||
- VOD category filtering now correctly handles category names containing pipe "|" characters (e.g., "PL | BAJKI", "EN | MOVIES") by using `rsplit()` to split from the right instead of the left, ensuring the category type is correctly extracted as the last segment - Thanks [@Vitekant](https://github.com/Vitekant)
|
||||
- M3U and EPG URLs now correctly preserve non-standard HTTPS ports (e.g., `:8443`) when accessed behind reverse proxies that forward the port in headers — `get_host_and_port()` now properly checks `X-Forwarded-Port` header before falling back to other detection methods (Fixes #704)
|
||||
- M3U and EPG manager page no longer crashes when a playlist references a deleted channel group (Fixes screen blank on navigation)
|
||||
|
|
|
|||
|
|
@ -1292,8 +1292,17 @@ def batch_process_episodes(account, series, episodes_data, scan_start_time=None)
|
|||
try:
|
||||
episode_id = str(episode_data.get('id'))
|
||||
episode_name = episode_data.get('title', 'Unknown Episode')
|
||||
season_number = episode_data['_season_number']
|
||||
episode_number = episode_data.get('episode_num', 0)
|
||||
# Ensure season and episode numbers are integers (API may return strings)
|
||||
try:
|
||||
season_number = int(episode_data['_season_number'])
|
||||
except (ValueError, TypeError) as e:
|
||||
logger.warning(f"Invalid season_number '{episode_data.get('_season_number')}' for episode '{episode_name}': {e}")
|
||||
season_number = 0
|
||||
try:
|
||||
episode_number = int(episode_data.get('episode_num', 0))
|
||||
except (ValueError, TypeError) as e:
|
||||
logger.warning(f"Invalid episode_num '{episode_data.get('episode_num')}' for episode '{episode_name}': {e}")
|
||||
episode_number = 0
|
||||
info = episode_data.get('info', {})
|
||||
|
||||
# Extract episode metadata
|
||||
|
|
@ -1324,7 +1333,7 @@ def batch_process_episodes(account, series, episodes_data, scan_start_time=None)
|
|||
# Check if we already have this episode pending creation (multiple streams for same episode)
|
||||
if not episode and episode_key in episodes_pending_creation:
|
||||
episode = episodes_pending_creation[episode_key]
|
||||
logger.debug(f"Reusing pending episode for S{season_number:02d}E{episode_number:02d} (stream_id: {episode_id})")
|
||||
logger.debug(f"Reusing pending episode for S{season_number}E{episode_number} (stream_id: {episode_id})")
|
||||
|
||||
if episode:
|
||||
# Update existing episode
|
||||
|
|
@ -1432,6 +1441,21 @@ def batch_process_episodes(account, series, episodes_data, scan_start_time=None)
|
|||
if key in episode_pk_map:
|
||||
relation.episode = episode_pk_map[key]
|
||||
|
||||
# Filter out relations with unsaved episodes (no PK)
|
||||
# This can happen if bulk_create had a conflict and ignore_conflicts=True didn't save the episode
|
||||
valid_relations_to_create = []
|
||||
for relation in relations_to_create:
|
||||
if relation.episode.pk is not None:
|
||||
valid_relations_to_create.append(relation)
|
||||
else:
|
||||
season_num = relation.episode.season_number
|
||||
episode_num = relation.episode.episode_number
|
||||
logger.warning(
|
||||
f"Skipping relation for episode S{season_num}E{episode_num} "
|
||||
f"- episode not saved to database"
|
||||
)
|
||||
relations_to_create = valid_relations_to_create
|
||||
|
||||
# Update existing episodes
|
||||
if episodes_to_update:
|
||||
Episode.objects.bulk_update(episodes_to_update, [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue