mirror of
https://github.com/THIS-IS-NOT-A-BACKUP/zspotify.git
synced 2025-07-01 15:23:15 +00:00
Downloads entire track at once now
This commit is contained in:
parent
16872e08ec
commit
3feb7fda0f
@ -449,12 +449,9 @@ def download_track(track_id_str: str, extra_paths=""):
|
|||||||
os.makedirs(ROOT_PATH + extra_paths)
|
os.makedirs(ROOT_PATH + extra_paths)
|
||||||
|
|
||||||
with open(filename, 'wb') as file:
|
with open(filename, 'wb') as file:
|
||||||
while True:
|
# Try's to download the entire track at once now to be more efficient.
|
||||||
# Try's to read exactly 128kb at a time to be more efficient now
|
byte = stream.input_stream.stream().read(-1)
|
||||||
byte = stream.input_stream.stream().read(1024 * 128)
|
file.write(byte)
|
||||||
if byte == b'':
|
|
||||||
break
|
|
||||||
file.write(byte)
|
|
||||||
if not RAW_AUDIO_AS_IS:
|
if not RAW_AUDIO_AS_IS:
|
||||||
try:
|
try:
|
||||||
convert_audio_format(filename)
|
convert_audio_format(filename)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user