mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-12-03 06:25:10 +00:00
feat(hls): carry a held media playlist over --remote and export, inflate gzip segments, add own_stream_only mux opt-in
This commit is contained in:
@@ -4,7 +4,7 @@ from types import SimpleNamespace
|
||||
import pytest
|
||||
|
||||
from unshackle.core import binaries
|
||||
from unshackle.core.tracks import Tracks, Video
|
||||
from unshackle.core.tracks import Audio, Tracks, Video
|
||||
from unshackle.core.tracks.tracks import file_track_ids
|
||||
|
||||
|
||||
@@ -81,6 +81,27 @@ def test_embedded_audio_options_are_left_out_when_the_file_has_no_audio(tmp_path
|
||||
assert "--track-name" not in args
|
||||
|
||||
|
||||
@pytest.mark.parametrize("own", [True, False])
|
||||
def test_a_video_with_own_stream_only_muxes_without_its_audio(tmp_path, mux_args, own):
|
||||
args = mux_args(
|
||||
Tracks(downloaded(make_video("v1", audio_language="ko", own_stream_only=own), tmp_path)),
|
||||
{"video": 0, "audio": 1},
|
||||
)
|
||||
assert ("--no-audio" in args) == own
|
||||
assert ("--track-name" in args) != own
|
||||
|
||||
|
||||
@pytest.mark.parametrize("own", [True, False])
|
||||
def test_an_audio_track_with_own_stream_only_muxes_without_its_video(tmp_path, mux_args, own):
|
||||
audio = Audio(url="https://example.test/a.m3u8", language="th", codec=Audio.Codec.AAC)
|
||||
audio.data["own_stream_only"] = own
|
||||
audio.path = tmp_path / "a.ts"
|
||||
audio.path.write_bytes(b"\x00" * 16)
|
||||
args = mux_args(Tracks(audio), {"video": 0, "audio": 1})
|
||||
assert ("--no-video" in args) == own
|
||||
assert args[args.index("--language") + 1] == ("1:th" if own else "0:th")
|
||||
|
||||
|
||||
def test_repack_and_mux_share_the_embedded_audio_name():
|
||||
assert make_video("v1", audio_language="zh").embedded_audio_name() == "Chinese"
|
||||
assert make_video("v1", audio_language="zh", audio_language_name="Mandarin").embedded_audio_name() == "Mandarin"
|
||||
|
||||
Reference in New Issue
Block a user