Merge branch 'master' of uh_wot/deemix into master

This commit is contained in:
RemixDev 2020-03-01 21:31:40 +00:00 committed by Gogs
commit 0e9ee1d874
2 changed files with 3 additions and 3 deletions

View File

@ -242,19 +242,19 @@ class Deezer:
response = open(input, 'rb') response = open(input, 'rb')
outfile = open(output, 'wb') outfile = open(output, 'wb')
blowfish_key = str.encode(self._get_blowfish_key(str(track_id))) blowfish_key = str.encode(self._get_blowfish_key(str(track_id)))
blowfish = Blowfish.new(blowfish_key, Blowfish.MODE_CBC, b"\x00\x01\x02\x03\x04\x05\x06\x07")
i = 0 i = 0
while True: while True:
chunk = response.read(2048) chunk = response.read(2048)
if not chunk: if not chunk:
break break
if (i % 3) == 0 and len(chunk) == 2048: if (i % 3) == 0 and len(chunk) == 2048:
chunk = blowfish.decrypt(chunk) chunk = Blowfish.new(blowfish_key, Blowfish.MODE_CBC, b"\x00\x01\x02\x03\x04\x05\x06\x07").decrypt(chunk)
outfile.write(chunk) outfile.write(chunk)
i += 1 i += 1
def stream_track(self, track_id, url, stream): def stream_track(self, track_id, url, stream):
request = requests.get(url, stream=True) request = requests.get(url, stream=True)
request.raise_for_status()
blowfish_key = str.encode(self._get_blowfish_key(str(track_id))) blowfish_key = str.encode(self._get_blowfish_key(str(track_id)))
i = 0 i = 0
for chunk in request.iter_content(2048): for chunk in request.iter_content(2048):

View File

@ -311,7 +311,7 @@ def downloadTrackObj(trackAPI, settings, overwriteBitrate=False, extraTrack=None
with open(writepath, 'wb') as stream: with open(writepath, 'wb') as stream:
dz.stream_track(track['id'], track['downloadUrl'], stream) dz.stream_track(track['id'], track['downloadUrl'], stream)
except HTTPError: except HTTPError:
remove(writePath) remove(writepath)
if track['selectedFormat'] == 9: if track['selectedFormat'] == 9:
print("Track not available in flac, trying mp3") print("Track not available in flac, trying mp3")
track['filesize']['flac'] = 0 track['filesize']['flac'] = 0