Reduce the download stop check to one if check in dl

This commit is contained in:
rlaphoenix 2023-03-01 08:55:40 +00:00
parent 840db6e689
commit 6a65617179
1 changed files with 4 additions and 9 deletions

View File

@ -754,11 +754,6 @@ class dl:
proxy=proxy,
license_widevine=prepare_drm
)
if self.DL_POOL_STOP.is_set():
# we stopped during the download, let's exit
return
# no else-if as DASH may convert the track to URL descriptor
if track.descriptor == track.Descriptor.URL:
if not track.drm and isinstance(track, (Video, Audio)):
@ -781,10 +776,6 @@ class dl:
progress=progress
)
if self.DL_POOL_STOP.is_set():
# we stopped during the download, let's exit
return
track.path = save_path
if track.drm:
@ -794,6 +785,10 @@ class dl:
if callable(track.OnDecrypted):
track.OnDecrypted(track)
if self.DL_POOL_STOP.is_set():
# we stopped during the download, let's exit
return
if track.path.stat().st_size <= 3: # Empty UTF-8 BOM == 3 bytes
raise IOError(
"Download failed, the downloaded file is empty. "