forked from kenzuya/unshackle
fix(netflix): improve audio and subtitle track hydration logic
- Update joc value for atmos content profile from 6 to 16 - Add informative log message summarizing total audio and subtitle tracks to hydrate - Refactor hydration loop to handle mismatched lengths of audio and subtitle tracks more clearly - Skip hydration if no audio tracks are available for the current index - Ensure valid subtitle track ID is used in manifest request to avoid API errors - Add detailed debug logs for processing hydrated audio and subtitle streams - Handle exceptions gracefully for each stream and track hydration step with warnings - Log when no tracks need hydration to improve observability
This commit is contained in:
@@ -750,7 +750,7 @@ class Netflix(Service):
|
||||
channels=stream["channels"],
|
||||
descriptive=audio.get("rawTrackType", "").lower() == "assistive",
|
||||
name="[Original]" if Language.get(audio["language"]).language == original_language.language else None,
|
||||
joc=6 if "atmos" in stream["content_profile"] else None
|
||||
joc=16 if "atmos" in stream["content_profile"] else None
|
||||
)
|
||||
)
|
||||
except Exception as e:
|
||||
@@ -831,7 +831,19 @@ class Netflix(Service):
|
||||
return tracks
|
||||
|
||||
# Hydrate missing tracks
|
||||
self.log.info(f"Getting all missing audio and subtitle tracks")
|
||||
if unavailable_audio_tracks or unavailable_subtitle:
|
||||
# Show hydration information once
|
||||
audio_count = len(unavailable_audio_tracks)
|
||||
subtitle_count = len(unavailable_subtitle)
|
||||
|
||||
hydration_parts = []
|
||||
if audio_count > 0:
|
||||
hydration_parts.append(f"audio ({audio_count})")
|
||||
if subtitle_count > 0:
|
||||
hydration_parts.append(f"subtitle ({subtitle_count})")
|
||||
|
||||
hydration_info = " and ".join(hydration_parts)
|
||||
self.log.info(f"Hydrating {hydration_info} tracks. Total: {audio_count + subtitle_count}")
|
||||
|
||||
# Handle mismatched lengths - use last successful subtitle track when needed
|
||||
last_successful_subtitle = ("N/A", "N/A") if not unavailable_subtitle else unavailable_subtitle[-1]
|
||||
@@ -916,8 +928,6 @@ class Netflix(Service):
|
||||
if subtitles and "downloadableIds" in subtitles and "ttDownloadables" in subtitles:
|
||||
subtitle_lang = subtitles.get("language", "unknown")
|
||||
self.log.debug(f"Processing hydrated subtitle track_id: {subtitle_hydration[1]}, language: {subtitle_lang}")
|
||||
# self.log.info(jsonpickle.encode(subtitles, indent=2))
|
||||
# sel
|
||||
|
||||
id = list(subtitles["downloadableIds"].values())
|
||||
if id:
|
||||
@@ -949,6 +959,8 @@ class Netflix(Service):
|
||||
except Exception as e:
|
||||
self.log.warning(f"Failed to hydrate tracks at hydration_index {hydration_index}, audio_track_id: {audio_hydration[1] if audio_hydration[1] != 'N/A' else 'N/A'}, subtitle_track_id: {subtitle_hydration[1] if subtitle_hydration[1] != 'N/A' else 'N/A'}, error: {e}")
|
||||
continue
|
||||
else:
|
||||
self.log.info("No tracks need hydration")
|
||||
|
||||
except Exception as e:
|
||||
self.log.error(f"Exception in manifest_as_tracks: {e}")
|
||||
|
||||
Reference in New Issue
Block a user