mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2024-12-20 12:04:03 +00:00
[downloader/external] Properly handle live stream downloading cancellation (closes #8932)
This commit is contained in:
parent
b364c87c42
commit
e7db6759e4
@ -29,7 +29,17 @@ class ExternalFD(FileDownloader):
|
|||||||
self.report_destination(filename)
|
self.report_destination(filename)
|
||||||
tmpfilename = self.temp_name(filename)
|
tmpfilename = self.temp_name(filename)
|
||||||
|
|
||||||
|
try:
|
||||||
retval = self._call_downloader(tmpfilename, info_dict)
|
retval = self._call_downloader(tmpfilename, info_dict)
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
if not info_dict.get('is_live'):
|
||||||
|
raise
|
||||||
|
# Live stream downloading cancellation should be considered as
|
||||||
|
# correct and expected termination thus all postprocessing
|
||||||
|
# should take place
|
||||||
|
retval = 0
|
||||||
|
self.to_screen('[%s] Interrupted by user' % self.get_basename())
|
||||||
|
|
||||||
if retval == 0:
|
if retval == 0:
|
||||||
fsize = os.path.getsize(encodeFilename(tmpfilename))
|
fsize = os.path.getsize(encodeFilename(tmpfilename))
|
||||||
self.to_screen('\r[%s] Downloaded %s bytes' % (self.get_basename(), fsize))
|
self.to_screen('\r[%s] Downloaded %s bytes' % (self.get_basename(), fsize))
|
||||||
|
Loading…
Reference in New Issue
Block a user