Skip to content
Snippets Groups Projects
Commit 09855474 authored by EorlBruder's avatar EorlBruder Committed by Georg Krause
Browse files

Don't abort whole download, when one file doesn't exist

parent 5078d71b
Branches
No related tags found
1 merge request!12Don't abort whole download, when one file doesn't exist
...@@ -36,10 +36,10 @@ async def get_track_download_url(id, remote, format=None): ...@@ -36,10 +36,10 @@ async def get_track_download_url(id, remote, format=None):
download_url = payload["uploads"][0]["listen_url"] download_url = payload["uploads"][0]["listen_url"]
except IndexError: except IndexError:
if remote.token: if remote.token:
raise click.ClickException("This file is not available for download") raise click.ClickException("This file is not available for download: " + id)
else: else:
raise click.ClickException( raise click.ClickException(
"This file is not available for download, try to login first" "This file is not available for download, try to login first: " + id
) )
if download_url.startswith("/"): if download_url.startswith("/"):
...@@ -73,9 +73,13 @@ async def track_download( ...@@ -73,9 +73,13 @@ async def track_download(
async with ctx.obj["remote"]: async with ctx.obj["remote"]:
progressbar = tqdm.tqdm(id, unit="Files") progressbar = tqdm.tqdm(id, unit="Files")
for i in progressbar: for i in progressbar:
try:
download_url, format, track_data = await get_track_download_url( download_url, format, track_data = await get_track_download_url(
i, ctx.obj["remote"], format=format i, ctx.obj["remote"], format=format
) )
except click.ClickException as e:
logs.logger.error(e.message)
continue
logs.logger.info("Downloading from {}".format(download_url)) logs.logger.info("Downloading from {}".format(download_url))
filename_params = utils.flatten(track_data) filename_params = utils.flatten(track_data)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment