forked from DRMTalks/devine
Reduce the download stop check to one if check in dl
This commit is contained in:
parent
840db6e689
commit
6a65617179
|
@ -754,11 +754,6 @@ class dl:
|
||||||
proxy=proxy,
|
proxy=proxy,
|
||||||
license_widevine=prepare_drm
|
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
|
# no else-if as DASH may convert the track to URL descriptor
|
||||||
if track.descriptor == track.Descriptor.URL:
|
if track.descriptor == track.Descriptor.URL:
|
||||||
if not track.drm and isinstance(track, (Video, Audio)):
|
if not track.drm and isinstance(track, (Video, Audio)):
|
||||||
|
@ -781,10 +776,6 @@ class dl:
|
||||||
progress=progress
|
progress=progress
|
||||||
)
|
)
|
||||||
|
|
||||||
if self.DL_POOL_STOP.is_set():
|
|
||||||
# we stopped during the download, let's exit
|
|
||||||
return
|
|
||||||
|
|
||||||
track.path = save_path
|
track.path = save_path
|
||||||
|
|
||||||
if track.drm:
|
if track.drm:
|
||||||
|
@ -794,6 +785,10 @@ class dl:
|
||||||
if callable(track.OnDecrypted):
|
if callable(track.OnDecrypted):
|
||||||
track.OnDecrypted(track)
|
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
|
if track.path.stat().st_size <= 3: # Empty UTF-8 BOM == 3 bytes
|
||||||
raise IOError(
|
raise IOError(
|
||||||
"Download failed, the downloaded file is empty. "
|
"Download failed, the downloaded file is empty. "
|
||||||
|
|
Loading…
Reference in New Issue