forked from kenzuya/unshackle
fix(import): say an import uses the export's keys, not a server CDM
The CDM type stub now follows the exported DRM system.
This commit is contained in:
@@ -293,6 +293,17 @@ def test_import_with_no_usable_title_says_so(tmp_path: Path) -> None:
|
||||
ImportService(import_ctx(), "EXAMPLE", "movie-1", str(export))
|
||||
|
||||
|
||||
@pytest.mark.parametrize(("system", "expected"), [("playready", "playready"), ("widevine", "widevine")])
|
||||
def test_import_takes_its_drm_type_from_the_export(tmp_path: Path, system: str, expected: str) -> None:
|
||||
"""The type stub routes the DRM objects, so it follows the exported system, not a widevine default."""
|
||||
export = crit_export(tmp_path / "export.json")
|
||||
doc = read_export(export)
|
||||
doc["titles"][0]["drm"] = [{"system": system, "pssh": "AAAA"}]
|
||||
export.write_text(json.dumps(doc), encoding="utf8")
|
||||
|
||||
assert ImportService(import_ctx(), "EXAMPLE", "movie-1", str(export))._server_cdm_type == expected
|
||||
|
||||
|
||||
class KeyDRM:
|
||||
"""A licensed DRM system that holds only ``content_keys``."""
|
||||
|
||||
|
||||
@@ -2935,7 +2935,12 @@ class dl:
|
||||
if getattr(self._remote_service, "_server_cdm", False):
|
||||
server_cdm_type = getattr(self._remote_service, "_server_cdm_type", "widevine")
|
||||
self.cdm = cdm_type_stub(server_cdm_type)
|
||||
self.log.info(f"Using server CDM ({server_cdm_type.title()}); no local CDM required")
|
||||
from unshackle.core.import_service import ImportService
|
||||
|
||||
if isinstance(self._remote_service, ImportService):
|
||||
self.log.info("Using keys from the export; no CDM required")
|
||||
else:
|
||||
self.log.info(f"Using server CDM ({server_cdm_type.title()}); no local CDM required")
|
||||
|
||||
video_tracks = title.tracks.videos
|
||||
if video_tracks and not server_cdm_type:
|
||||
|
||||
@@ -173,7 +173,7 @@ class ImportService:
|
||||
self.tracks_by_title: dict[str, Tracks] = {}
|
||||
|
||||
self._server_cdm = True
|
||||
self._server_cdm_type = "widevine"
|
||||
self._server_cdm_type = "playready" if self.exported_drm_system() == "playready" else "widevine"
|
||||
|
||||
first = self.doc.titles[0]
|
||||
# a title with no manifest keeps its request headers on its file rows
|
||||
|
||||
Reference in New Issue
Block a user