select dutch audio
Build and Push Docker Images / build-and-push (push) Successful in 22s

This commit is contained in:
2026-02-11 21:59:05 +01:00
parent df941720e3
commit 5218d624d7
3 changed files with 16 additions and 16 deletions
+1 -1
View File
@@ -56,7 +56,7 @@ Each channel in the M3U points to a **continuous live stream** (`/live/<id>`): F
- `GET /epg.xml` or `GET /xmltv.xml` — XMLTV EPG (duration set by `EPG_TIMESPAN`, UTC)
- `GET /live/<channel_id>` — continuous MPEG-TS stream for that channel (for tuning/recording)
- `GET /channel/<id>/playlist.m3u` — single channel M3U (list of individual video URLs)
- `GET /stream?path=movies/...` or `path=series/...` — stream a single video file (audio track is auto-selected: Dutch/Flemish → English → default)
- `GET /stream?path=movies/...` or `path=series/...` — stream a single video file (audio track is auto-selected: Dutch → Flemish → default)
## Shuffle behaviour
+2 -2
View File
@@ -58,5 +58,5 @@ except (TypeError, ValueError):
TMDB_IMAGE_BASE = "https://image.tmdb.org/t/p"
TMDB_IMAGE_STILL_SIZE = "w500"
# Preferred audio languages for streaming
PREFERRED_AUDIO_LANGUAGES = ("nld", "dut", "eng")
# Preferred audio languages for streaming (in order): Dutch → Flemish → default
PREFERRED_AUDIO_LANGUAGES = ("nld", "dut", "nl", "vls")
+12 -12
View File
@@ -7,12 +7,7 @@ import tempfile
from pathlib import Path
from urllib.parse import unquote
from .config import (
VIDEO_EXTENSIONS,
MOVIES_ROOT,
SERIES_ROOT,
PREFERRED_AUDIO_LANGUAGES,
)
from .config import VIDEO_EXTENSIONS, MOVIES_ROOT, SERIES_ROOT
logger = logging.getLogger(__name__)
@@ -50,7 +45,7 @@ def path_to_absolute(path_param: str) -> Path | None:
def get_preferred_audio_stream_index(path: Path) -> int | None:
"""
Probe the file with ffprobe and return the 0-based audio stream index to use:
first Dutch/Flemish (nld/dut), else first English (eng), else first audio stream.
Dutch (nld/dut/nl) if available, else Flemish (vls), else default (first audio).
Returns None on probe failure or no audio streams.
"""
try:
@@ -79,13 +74,18 @@ def get_preferred_audio_stream_index(path: Path) -> int | None:
if idx is None:
continue
tags = s.get("tags") or {}
lang = (tags.get("language") or "").strip().lower()[:3]
audio_streams.append((idx, lang))
raw = (tags.get("language") or "").strip().lower()
lang = raw[:3] if len(raw) >= 3 else raw
audio_streams.append((idx, lang, raw))
if not audio_streams:
return None
for pref in PREFERRED_AUDIO_LANGUAGES:
for idx, lang in audio_streams:
if lang == pref:
dutch = ("nld", "dut", "nl")
flemish = ("vls", "nl-be", "nlb")
for idx, lang, raw in audio_streams:
if lang in dutch or raw in dutch:
return idx
for idx, lang, raw in audio_streams:
if lang in flemish or raw in flemish:
return idx
return audio_streams[0][0]
except (