fix: Fix type error in pssh-box.py with Python 3.10+ (#1187)

A single-line change on #L170 to `wv.protection_scheme =
struct.unpack('>L', bytes(protection_scheme, encoding='utf-8'))[0]`,
needed to work around this issue on Ubuntu 22.04LTS+ running Python
3.10+:

```sh
TypeError: a bytes-like object is required, not 'str'
```
On line 170.
This commit is contained in:
Dennis E. Mungai 2023-05-01 19:06:56 +03:00 committed by GitHub
parent d5ca6e84e6
commit 161947f53e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -167,7 +167,7 @@ def _generate_widevine_data(key_ids, content_id, provider, protection_scheme):
wv.content_id = content_id
# 'cenc' is the default, so omitted to save bytes.
if protection_scheme and protection_scheme != 'cenc':
wv.protection_scheme = struct.unpack('>L', protection_scheme)[0]
wv.protection_scheme = struct.unpack('>L', protection_scheme.encode())[0]
return wv.SerializeToString()