From 86e17d04d9ca6178e3d4e0b809645fb69ccac7dd Mon Sep 17 00:00:00 2001 From: uh_wot <3631986-uh_wot@users.noreply.gitlab.com> Date: Sat, 29 Feb 2020 22:34:26 +0100 Subject: [PATCH] forgot playlists --- deemix/app/downloader.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/deemix/app/downloader.py b/deemix/app/downloader.py index 4d978c5..f985640 100644 --- a/deemix/app/downloader.py +++ b/deemix/app/downloader.py @@ -356,8 +356,9 @@ def download_album(id, settings, overwriteBitrate=False): def download_playlist(id, settings, overwriteBitrate=False): playlistAPI = dz.get_playlist(id) playlistTracksAPI = dz.get_playlist_tracks_gw(id) - for pos, trackAPI in enumerate(playlistTracksAPI, start=1): - trackAPI['_EXTRA_PLAYLIST'] = playlistAPI - trackAPI['POSITION'] = pos - trackAPI['FILENAME_TEMPLATE'] = settings['playlistTracknameTemplate'] - downloadTrackObj(trackAPI, settings, overwriteBitrate) + with ThreadPoolExecutor(settings['queueConcurrency']) as executor: + for pos, trackAPI in enumerate(playlistTracksAPI, start=1): + trackAPI['_EXTRA_PLAYLIST'] = playlistAPI + trackAPI['POSITION'] = pos + trackAPI['FILENAME_TEMPLATE'] = settings['playlistTracknameTemplate'] + executor.submit(downloadTrackObj, trackAPI, settings, overwriteBitrate)