added multi-threaded downloading
This commit is contained in:
parent
61c2a337d7
commit
8a6afd969c
|
@ -7,6 +7,7 @@ from os import makedirs
|
|||
from requests import get
|
||||
from requests.exceptions import HTTPError
|
||||
from tempfile import gettempdir
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
|
||||
dz = Deezer()
|
||||
TEMPDIR = os.path.join(gettempdir(), 'deezloader-imgs')
|
||||
|
@ -346,10 +347,11 @@ def download_album(id, settings, overwriteBitrate=False):
|
|||
downloadTrackObj(trackAPI, settings, overwriteBitrate)
|
||||
else:
|
||||
tracksArray = dz.get_album_tracks_gw(id)
|
||||
with ThreadPoolExecutor(settings['queueConcurrency']) as executor:
|
||||
for trackAPI in tracksArray:
|
||||
trackAPI['_EXTRA_ALBUM'] = albumAPI
|
||||
trackAPI['FILENAME_TEMPLATE'] = settings['albumTracknameTemplate']
|
||||
downloadTrackObj(trackAPI, settings, overwriteBitrate)
|
||||
executor.submit(downloadTrackObj, trackAPI, settings, overwriteBitrate)
|
||||
|
||||
def download_playlist(id, settings, overwriteBitrate=False):
|
||||
playlistAPI = dz.get_playlist(id)
|
||||
|
|
Loading…
Reference in New Issue