diff options
| author | jvoisin | 2018-10-22 19:12:39 +0200 |
|---|---|---|
| committer | jvoisin | 2018-10-23 13:49:58 +0200 |
| commit | 38df679a88a19db3a4a82fdb8e20a42c9a53d1a1 (patch) | |
| tree | e7eea36bae3341a97e2b9a730964cfe632fb74f5 /libmat2/video.py | |
| parent | 44f267a5964ea8dbb59c26c319e43fad84afb45a (diff) | |
Optimize the handling of problematic files
Diffstat (limited to 'libmat2/video.py')
| -rw-r--r-- | libmat2/video.py | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/libmat2/video.py b/libmat2/video.py index 2fa65e8..fe2a1af 100644 --- a/libmat2/video.py +++ b/libmat2/video.py | |||
| @@ -24,10 +24,9 @@ class AVIParser(exiftool.ExiftoolParser): | |||
| 24 | 'SampleRate', 'AvgBytesPerSec', 'BitsPerSample', | 24 | 'SampleRate', 'AvgBytesPerSec', 'BitsPerSample', |
| 25 | 'Duration', 'ImageSize', 'Megapixels'} | 25 | 'Duration', 'ImageSize', 'Megapixels'} |
| 26 | 26 | ||
| 27 | 27 | def remove_all(self): | |
| 28 | def __remove_all_internal(self, filename: str): | ||
| 29 | cmd = [_get_ffmpeg_path(), | 28 | cmd = [_get_ffmpeg_path(), |
| 30 | '-i', filename, # input file | 29 | '-i', self.filename, # input file |
| 31 | '-y', # overwrite existing output file | 30 | '-y', # overwrite existing output file |
| 32 | '-loglevel', 'panic', # Don't show log | 31 | '-loglevel', 'panic', # Don't show log |
| 33 | '-hide_banner', # hide the banner | 32 | '-hide_banner', # hide the banner |
| @@ -38,11 +37,8 @@ class AVIParser(exiftool.ExiftoolParser): | |||
| 38 | '-flags:v', '+bitexact', # don't add any metadata | 37 | '-flags:v', '+bitexact', # don't add any metadata |
| 39 | '-flags:a', '+bitexact', # don't add any metadata | 38 | '-flags:a', '+bitexact', # don't add any metadata |
| 40 | self.output_filename] | 39 | self.output_filename] |
| 41 | subprocess.check_call(cmd) | ||
| 42 | |||
| 43 | def remove_all(self) -> bool: | ||
| 44 | try: | 40 | try: |
| 45 | self._handle_problematic_filename(self.__remove_all_internal) | 41 | subprocess.check_call(cmd) |
| 46 | except subprocess.CalledProcessError as e: | 42 | except subprocess.CalledProcessError as e: |
| 47 | logging.error("Something went wrong during the processing of %s: %s", self.filename, e) | 43 | logging.error("Something went wrong during the processing of %s: %s", self.filename, e) |
| 48 | return False | 44 | return False |
