fix(n_m3u8dl_re): include language in DASH audio track selection

When DASH manifests have multiple audio AdaptationSets with the same representation IDs (e.g., both English and Japanese having id="0"), N_m3u8DL-RE would download the same track twice.

Now includes the language alongside the ID in selection args to properly disambiguate tracks across adaptation sets.
This commit is contained in:
Andy
2026-01-19 20:18:45 +00:00
parent 90a7db2e46
commit 477fd7f2eb

View File

@@ -67,12 +67,17 @@ def get_track_selection_args(track: Any) -> list[str]:
parts = [] parts = []
if track_type == "Audio": if track_type == "Audio":
if track_id := representation.get("id") or adaptation_set.get("audioTrackId"): track_id = representation.get("id") or adaptation_set.get("audioTrackId")
lang = representation.get("lang") or adaptation_set.get("lang")
if track_id:
parts.append(rf'"id=\b{track_id}\b"') parts.append(rf'"id=\b{track_id}\b"')
if lang:
parts.append(f"lang={lang}")
else: else:
if codecs := representation.get("codecs"): if codecs := representation.get("codecs"):
parts.append(f"codecs={codecs}") parts.append(f"codecs={codecs}")
if lang := representation.get("lang") or adaptation_set.get("lang"): if lang:
parts.append(f"lang={lang}") parts.append(f"lang={lang}")
if bw := representation.get("bandwidth"): if bw := representation.get("bandwidth"):
bitrate = int(bw) // 1000 bitrate = int(bw) // 1000