mirror of
https://github.com/unshackle-dl/unshackle.git
synced 2026-11-27 11:25:08 +00:00
fix(manifests): skip filtered dash periods after the main content and keep them over export
A manifest snapshot module now saves and restores DASH/ISM parser state for --remote and export/import, so an import keeps the service's period filter without fetching the manifest.
This commit is contained in:
@@ -6,8 +6,7 @@ import pytest
|
||||
from langcodes import Language
|
||||
from lxml import etree
|
||||
|
||||
from unshackle.core.api.handlers import extract_track_manifests
|
||||
from unshackle.core.remote_service import resolve_track_manifests
|
||||
from unshackle.core.manifests.snapshot import capture, restore
|
||||
from unshackle.core.tracks import Subtitle, Tracks
|
||||
|
||||
pytestmark = pytest.mark.unit
|
||||
@@ -53,8 +52,8 @@ def test_detached_adaptation_set_round_trips() -> None:
|
||||
)
|
||||
tracks = Tracks([track])
|
||||
|
||||
fragments = extract_track_manifests(tracks)
|
||||
assert len(fragments) == 1
|
||||
snapshot = capture(tracks)
|
||||
assert len(snapshot["track_manifests"]) == 1
|
||||
|
||||
client_track = Subtitle(
|
||||
id_="abc123",
|
||||
@@ -63,7 +62,7 @@ def test_detached_adaptation_set_round_trips() -> None:
|
||||
language=Language.get("en"),
|
||||
descriptor=Subtitle.Descriptor.URL,
|
||||
)
|
||||
resolve_track_manifests(Tracks([client_track]), fragments)
|
||||
restore(Tracks([client_track]), snapshot)
|
||||
|
||||
dash = client_track.data["dash"]
|
||||
assert dash["manifest"].find("BaseURL").text == "https://cdn.example/base/"
|
||||
@@ -101,7 +100,7 @@ def test_single_track_manifest_round_trips_by_id() -> None:
|
||||
sdh=True,
|
||||
descriptor=Subtitle.Descriptor.URL,
|
||||
)
|
||||
resolve_track_manifests(Tracks([client_track]), extract_track_manifests(Tracks([track])))
|
||||
restore(Tracks([client_track]), capture(Tracks([track])))
|
||||
|
||||
assert client_track.descriptor == Subtitle.Descriptor.DASH
|
||||
assert client_track.data["dash"]["representation_id"] == "sub-0"
|
||||
@@ -127,7 +126,7 @@ def test_in_tree_adaptation_set_is_not_shipped() -> None:
|
||||
}
|
||||
},
|
||||
)
|
||||
assert extract_track_manifests(Tracks([track])) == []
|
||||
assert capture(Tracks([track]))["track_manifests"] == []
|
||||
|
||||
|
||||
def test_fragment_keeps_only_the_track_representation() -> None:
|
||||
@@ -153,7 +152,7 @@ def test_fragment_keeps_only_the_track_representation() -> None:
|
||||
language=Language.get("en"),
|
||||
descriptor=Subtitle.Descriptor.URL,
|
||||
)
|
||||
resolve_track_manifests(Tracks([client_track]), extract_track_manifests(Tracks([track])))
|
||||
restore(Tracks([client_track]), capture(Tracks([track])))
|
||||
|
||||
dash = client_track.data["dash"]
|
||||
assert dash["representation_id"] == "sub-1"
|
||||
|
||||
Reference in New Issue
Block a user