From aff40df7d158f737e9cecddaaf0217cd363e2d1d Mon Sep 17 00:00:00 2001 From: rlaphoenix Date: Sat, 15 Jul 2023 18:13:24 +0100 Subject: [PATCH] Raise CalledProcessError if Shaka logs an error This seems to be necessary as Shaka-packager seems to always return exit code 0, even on errors. --- devine/core/drm/widevine.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/devine/core/drm/widevine.py b/devine/core/drm/widevine.py index f12a8ac3..42160ed1 100644 --- a/devine/core/drm/widevine.py +++ b/devine/core/drm/widevine.py @@ -259,6 +259,7 @@ def decrypt(self, path: Path) -> None: ) stream_skipped = False + had_error = False shaka_log_buffer = "" for line in iter(p.stderr.readline, ""): @@ -270,6 +271,8 @@ def decrypt(self, path: Path) -> None: stream_skipped = True if ":INFO:" in line: continue + if ":ERROR:" in line: + had_error = True if "Insufficient bits in bitstream for given AVC profile" in line: # this is a warning and is something we don't have to worry about continue @@ -286,7 +289,7 @@ def decrypt(self, path: Path) -> None: p.wait() - if p.returncode != 0: + if p.returncode != 0 or had_error: raise subprocess.CalledProcessError(p.returncode, arguments) path.unlink()