

def create_decryptor(self, key, sequence):
    if (key.method != 'AES-128'):
        raise StreamError('Unable to decrypt cipher {0}', key.method)
    if (not key.uri):
        raise StreamError('Missing URI to decryption key')
    if (self.key_uri != key.uri):
        res = self.session.http.get(key.uri, exception=StreamError, **self.reader.request_params)
        self.key_data = res.content
        self.key_uri = key.uri
    iv = (key.iv or num_to_iv(sequence))
    iv = ((b'\x00' * (16 - len(iv))) + iv)
    return AES.new(self.key_data, AES.MODE_CBC, iv)

dataset/ETHPy150Open chrippa/livestreamer/src/livestreamer/stream/hls.py HLSStreamWriter.create_decryptor/original