aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/postprocessor/ffmpeg.py
diff options
context:
space:
mode:
authorJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>2015-03-27 13:02:20 +0100
committerJaime Marquínez Ferrándiz <jaime.marquinez.ferrandiz@gmail.com>2015-03-27 13:02:20 +0100
commit70a1165b32acf253905109e9b4f245295d67af1f (patch)
treed217fe80bed21e76accf73cd767804b231d1fe93 /youtube_dl/postprocessor/ffmpeg.py
parentaf140002158c1079b1365392c6a48ea06ad23c82 (diff)
downloadyoutube-dl-70a1165b32acf253905109e9b4f245295d67af1f.tar.xz
Don't use bare 'except:'
They catch any exception, including KeyboardInterrupt, we don't want to catch it.
Diffstat (limited to 'youtube_dl/postprocessor/ffmpeg.py')
-rw-r--r--youtube_dl/postprocessor/ffmpeg.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/youtube_dl/postprocessor/ffmpeg.py b/youtube_dl/postprocessor/ffmpeg.py
index b6f51cfd5..55adf9685 100644
--- a/youtube_dl/postprocessor/ffmpeg.py
+++ b/youtube_dl/postprocessor/ffmpeg.py
@@ -3,7 +3,6 @@ from __future__ import unicode_literals
import io
import os
import subprocess
-import sys
import time
@@ -269,19 +268,17 @@ class FFmpegExtractAudioPP(FFmpegPostProcessor):
else:
self._downloader.to_screen('[' + self.basename + '] Destination: ' + new_path)
self.run_ffmpeg(path, new_path, acodec, more_opts)
- except:
- etype, e, tb = sys.exc_info()
- if isinstance(e, AudioConversionError):
- msg = 'audio conversion failed: ' + e.msg
- else:
- msg = 'error running ' + self.basename
- raise PostProcessingError(msg)
+ except AudioConversionError as e:
+ raise PostProcessingError(
+ 'audio conversion failed: ' + e.msg)
+ except Exception:
+ raise PostProcessingError('error running ' + self.basename)
# Try to update the date time for extracted audio file.
if information.get('filetime') is not None:
try:
os.utime(encodeFilename(new_path), (time.time(), information['filetime']))
- except:
+ except Exception:
self._downloader.report_warning('Cannot update utime of audio file')
information['filepath'] = new_path