feat(drm)!: load DRM systems beyond the built-ins from plugins in directories.plugins

This commit is contained in:
imSp4rky
2026-12-03 15:51:42 -07:00
parent f8a248a29e
commit e9adc50594
65 changed files with 1651 additions and 2526 deletions
+5 -3
View File
@@ -15,7 +15,7 @@ from unshackle.core import binaries
from unshackle.core import service as service_mod
from unshackle.core.api.errors import categorize_exception
from unshackle.core.api.input_bridge import InputBridge, NoUserBridge
from unshackle.core.drm import ClearKeyCENC, MonaLisa, PlayReady, Widevine, decrypters
from unshackle.core.drm import ClearKeyCENC, CustomDRM, PlayReady, Widevine, decrypters
from unshackle.core.import_service import ImportService, manifest_fetch_error
from unshackle.core.proxies.gluetun import Gluetun
from unshackle.core.proxies.nordvpn import NordVPN
@@ -108,14 +108,16 @@ def test_an_import_key_the_export_lacks_is_a_drm_error() -> None:
PlayReady.Exceptions.KIDNotFound,
PlayReady.Exceptions.DeviceRevoked,
ClearKeyCENC.Exceptions.KIDNotFound,
MonaLisa.Exceptions.TicketNotFound,
MonaLisa.Exceptions.KeyExtractionFailed,
],
)
def test_a_drm_exception_class_is_a_drm_error(error: type[Exception]) -> None:
assert categorize_exception(error("PSSH was not found in track data.")).error_code == APIErrorCode.DRM_ERROR
def test_a_drm_plugin_that_is_not_installed_is_a_drm_error() -> None:
assert code_of(lambda: CustomDRM("example")) == APIErrorCode.DRM_ERROR
def test_a_missing_decrypter_is_a_drm_error(monkeypatch: pytest.MonkeyPatch) -> None:
monkeypatch.setattr(binaries, "Mp4decrypt", None)
monkeypatch.setattr(binaries, "ShakaPackager", None)