Added generic error exception to error log
This commit is contained in:
parent
9fa9f663fb
commit
9f55681103
|
@ -566,6 +566,20 @@ def downloadTrackObj(dz, trackAPI, settings, bitrate, queueItem, extraTrack=None
|
||||||
socket.emit("updateQueue", {'uuid': queueItem['uuid'], 'downloaded': True})
|
socket.emit("updateQueue", {'uuid': queueItem['uuid'], 'downloaded': True})
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
def downloadTrackObj_wrap(dz, track, settings, bitrate, queueItem, socket):
|
||||||
|
try:
|
||||||
|
result = downloadTrackObj(dz, track, settings, bitrate, queueItem, socket=socket)
|
||||||
|
except Exception as e:
|
||||||
|
result = {'error': {
|
||||||
|
'message': str(e)},
|
||||||
|
'data': {
|
||||||
|
'id': track['SNG_ID'],
|
||||||
|
'title': track['SNG_TITLE'] + (" "+track['VERSION'] if 'VERSION' in track and track['VERSION'] else ""),
|
||||||
|
'mainArtist': {'name': track['ART_NAME']}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
|
||||||
def download(dz, queueItem, socket=None):
|
def download(dz, queueItem, socket=None):
|
||||||
global downloadPercentage, lastPercentage
|
global downloadPercentage, lastPercentage
|
||||||
settings = queueItem['settings']
|
settings = queueItem['settings']
|
||||||
|
@ -573,14 +587,24 @@ def download(dz, queueItem, socket=None):
|
||||||
downloadPercentage = 0
|
downloadPercentage = 0
|
||||||
lastPercentage = 0
|
lastPercentage = 0
|
||||||
if 'single' in queueItem:
|
if 'single' in queueItem:
|
||||||
|
try:
|
||||||
result = downloadTrackObj(dz, queueItem['single'], settings, bitrate, queueItem, socket=socket)
|
result = downloadTrackObj(dz, queueItem['single'], settings, bitrate, queueItem, socket=socket)
|
||||||
|
except Exception as e:
|
||||||
|
result = {'error': {
|
||||||
|
'message': str(e)},
|
||||||
|
'data': {
|
||||||
|
'id': track['SNG_ID'],
|
||||||
|
'title': track['SNG_TITLE'] + (" "+track['VERSION'] if 'VERSION' in track and track['VERSION'] else ""),
|
||||||
|
'mainArtist': {'name': track['ART_NAME']}
|
||||||
|
}
|
||||||
|
}
|
||||||
download_path = after_download_single(result, settings)
|
download_path = after_download_single(result, settings)
|
||||||
elif 'collection' in queueItem:
|
elif 'collection' in queueItem:
|
||||||
print("Downloading collection")
|
print("Downloading collection")
|
||||||
playlist = [None] * len(queueItem['collection'])
|
playlist = [None] * len(queueItem['collection'])
|
||||||
with ThreadPoolExecutor(settings['queueConcurrency']) as executor:
|
with ThreadPoolExecutor(settings['queueConcurrency']) as executor:
|
||||||
for pos, track in enumerate(queueItem['collection'], start=0):
|
for pos, track in enumerate(queueItem['collection'], start=0):
|
||||||
playlist[pos] = executor.submit(downloadTrackObj, dz, track, settings, bitrate, queueItem, socket=socket)
|
playlist[pos] = executor.submit(downloadTrackObj_wrap, dz, track, settings, bitrate, queueItem, socket=socket)
|
||||||
download_path = after_download(playlist, settings)
|
download_path = after_download(playlist, settings)
|
||||||
if socket:
|
if socket:
|
||||||
if 'cancel' in queueItem:
|
if 'cancel' in queueItem:
|
||||||
|
|
Loading…
Reference in New Issue