diff --git a/pywidevine/cdm.py b/pywidevine/cdm.py index 08dcfc0..eab5231 100644 --- a/pywidevine/cdm.py +++ b/pywidevine/cdm.py @@ -131,7 +131,7 @@ class Cdm: if len(self.__sessions) > self.MAX_NUM_OF_SESSIONS: raise TooManySessions(f"Too many Sessions open ({self.MAX_NUM_OF_SESSIONS}).") - session = Session() + session = Session(len(self.__sessions) + 1) self.__sessions[session.id] = session return session.id diff --git a/pywidevine/session.py b/pywidevine/session.py index cc123df..2bfcdaf 100644 --- a/pywidevine/session.py +++ b/pywidevine/session.py @@ -7,7 +7,8 @@ from pywidevine.license_protocol_pb2 import SignedMessage class Session: - def __init__(self): + def __init__(self, number: int): + self.number = number self.id = get_random_bytes(16) self.service_certificate: Optional[SignedMessage] = None self.context: dict[bytes, tuple[bytes, bytes]] = {}