mirror of
https://gitlab.com/RemixDev/deemix-py.git
synced 2024-12-28 18:46:13 +00:00
Consistent logging
This commit is contained in:
parent
b73d533c2b
commit
0a11f53c4c
|
@ -651,6 +651,8 @@ class DownloadJob:
|
||||||
chunkLength = start
|
chunkLength = start
|
||||||
percentage = 0
|
percentage = 0
|
||||||
|
|
||||||
|
itemName = f"[{track.mainArtist['name']} - {track.title}]"
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with self.dz.session.get(track.downloadUrl, headers=headers, stream=True, timeout=10) as request:
|
with self.dz.session.get(track.downloadUrl, headers=headers, stream=True, timeout=10) as request:
|
||||||
request.raise_for_status()
|
request.raise_for_status()
|
||||||
|
@ -662,9 +664,9 @@ class DownloadJob:
|
||||||
raise DownloadEmpty
|
raise DownloadEmpty
|
||||||
if start != 0:
|
if start != 0:
|
||||||
responseRange = request.headers["Content-Range"]
|
responseRange = request.headers["Content-Range"]
|
||||||
logger.info(f'{track.title} downloading range {responseRange}')
|
logger.info(f'{itemName} downloading range {responseRange}')
|
||||||
else:
|
else:
|
||||||
logger.info(f'{track.title} downloading {complete} bytes')
|
logger.info(f'{itemName} downloading {complete} bytes')
|
||||||
|
|
||||||
for chunk in request.iter_content(2048 * 3):
|
for chunk in request.iter_content(2048 * 3):
|
||||||
if self.queueItem.cancel: raise DownloadCancelled
|
if self.queueItem.cancel: raise DownloadCancelled
|
||||||
|
@ -685,7 +687,7 @@ class DownloadJob:
|
||||||
self.updatePercentage()
|
self.updatePercentage()
|
||||||
|
|
||||||
except SSLError as e:
|
except SSLError as e:
|
||||||
logger.info(f'retrying {track.title} from byte {chunkLength}')
|
logger.info(f'{itemName} retrying from byte {chunkLength}')
|
||||||
return self.streamTrack(stream, track, chunkLength)
|
return self.streamTrack(stream, track, chunkLength)
|
||||||
except (request_exception.ConnectionError, requests.exceptions.ReadTimeout):
|
except (request_exception.ConnectionError, requests.exceptions.ReadTimeout):
|
||||||
eventlet.sleep(2)
|
eventlet.sleep(2)
|
||||||
|
|
Loading…
Reference in a new issue