Restyled by yapf
This commit is contained in:
@@ -8,26 +8,24 @@ from librespot.audio.storage import ChannelManager
|
||||
|
||||
|
||||
class AesAudioDecrypt(AudioDecrypt):
|
||||
audio_aes_iv = bytes(
|
||||
[
|
||||
0x72,
|
||||
0xE0,
|
||||
0x67,
|
||||
0xFB,
|
||||
0xDD,
|
||||
0xCB,
|
||||
0xCF,
|
||||
0x77,
|
||||
0xEB,
|
||||
0xE8,
|
||||
0xBC,
|
||||
0x64,
|
||||
0x3F,
|
||||
0x63,
|
||||
0x0D,
|
||||
0x93,
|
||||
]
|
||||
)
|
||||
audio_aes_iv = bytes([
|
||||
0x72,
|
||||
0xE0,
|
||||
0x67,
|
||||
0xFB,
|
||||
0xDD,
|
||||
0xCB,
|
||||
0xCF,
|
||||
0x77,
|
||||
0xEB,
|
||||
0xE8,
|
||||
0xBC,
|
||||
0x64,
|
||||
0x3F,
|
||||
0x63,
|
||||
0x0D,
|
||||
0x93,
|
||||
])
|
||||
iv_int = int.from_bytes(audio_aes_iv, "big")
|
||||
iv_diff = 0x100
|
||||
cipher = None
|
||||
@@ -50,14 +48,12 @@ class AesAudioDecrypt(AudioDecrypt):
|
||||
)
|
||||
|
||||
count = min(4096, len(buffer) - i)
|
||||
decrypted_buffer = cipher.decrypt(buffer[i : i + count])
|
||||
decrypted_buffer = cipher.decrypt(buffer[i:i + count])
|
||||
new_buffer += decrypted_buffer
|
||||
if count != len(decrypted_buffer):
|
||||
raise RuntimeError(
|
||||
"Couldn't process all data, actual: {}, expected: {}".format(
|
||||
len(decrypted_buffer), count
|
||||
)
|
||||
)
|
||||
"Couldn't process all data, actual: {}, expected: {}".
|
||||
format(len(decrypted_buffer), count))
|
||||
|
||||
iv += self.iv_diff
|
||||
|
||||
@@ -67,8 +63,5 @@ class AesAudioDecrypt(AudioDecrypt):
|
||||
return new_buffer
|
||||
|
||||
def decrypt_time_ms(self):
|
||||
return (
|
||||
0
|
||||
if self.decrypt_count == 0
|
||||
else int((self.decrypt_total_time / self.decrypt_count) / 1000000)
|
||||
)
|
||||
return (0 if self.decrypt_count == 0 else int(
|
||||
(self.decrypt_total_time / self.decrypt_count) / 1000000))
|
||||
|
||||
Reference in New Issue
Block a user