Added better error reporting for generation in cli

This commit is contained in:
RemixDev 2021-07-16 14:55:11 +02:00
parent 4119617c6b
commit a7dd659e22
No known key found for this signature in database
GPG Key ID: B33962B465BDB51C
1 changed files with 6 additions and 1 deletions

View File

@ -10,6 +10,7 @@ from deemix.settings import load as loadSettings
from deemix.utils import getBitrateNumberFromText from deemix.utils import getBitrateNumberFromText
import deemix.utils.localpaths as localpaths import deemix.utils.localpaths as localpaths
from deemix.downloader import Downloader from deemix.downloader import Downloader
from deemix.itemgen import GenerationError
from deemix.plugins.spotify import Spotify from deemix.plugins.spotify import Spotify
class LogListener: class LogListener:
@ -65,7 +66,11 @@ def download(url, bitrate, portable, path):
links.append(link) links.append(link)
for link in links: for link in links:
try:
downloadObject = generateDownloadObject(dz, link, bitrate, plugins, listener) downloadObject = generateDownloadObject(dz, link, bitrate, plugins, listener)
except GenerationError as e:
print(f"{e.link}: {e.message}")
continue
if isinstance(downloadObject, list): if isinstance(downloadObject, list):
for obj in downloadObject: for obj in downloadObject:
Downloader(dz, obj, settings, listener).start() Downloader(dz, obj, settings, listener).start()