projects
/
youtube-dl
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
b364c87
)
[downloader/external] Properly handle live stream downloading cancellation (closes...
author
Sergey M․
<dstftw@gmail.com>
Fri, 28 Apr 2017 21:33:35 +0000
(
04:33
+0700)
committer
Sergey M․
<dstftw@gmail.com>
Fri, 28 Apr 2017 21:33:35 +0000
(
04:33
+0700)
youtube_dl/downloader/external.py
patch
|
blob
|
history
diff --git
a/youtube_dl/downloader/external.py
b/youtube_dl/downloader/external.py
index e13cf547d10cbf472440c9f23d010a586b2c453c..e78169a0dbeb2ab5613db5a55cb6ad25cd14555a 100644
(file)
--- a/
youtube_dl/downloader/external.py
+++ b/
youtube_dl/downloader/external.py
@@
-29,7
+29,17
@@
class ExternalFD(FileDownloader):
self.report_destination(filename)
tmpfilename = self.temp_name(filename)
self.report_destination(filename)
tmpfilename = self.temp_name(filename)
- retval = self._call_downloader(tmpfilename, info_dict)
+ try:
+ 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:
fsize = os.path.getsize(encodeFilename(tmpfilename))
self.to_screen('\r[%s] Downloaded %s bytes' % (self.get_basename(), fsize))
if retval == 0:
fsize = os.path.getsize(encodeFilename(tmpfilename))
self.to_screen('\r[%s] Downloaded %s bytes' % (self.get_basename(), fsize))