From d3f09d95eb65bbb62a5598bcfcd3f727679ec074 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Sun, 30 Oct 2011 11:36:43 +0100 Subject: Properly support cleaning files with spaces in their names. When exiftool's -All= option is immediately followed by another known exiftool option, there is no possible ambiguity and exiftool correctly interprets the last passed argument as a filename, even if this name contains spaces. --- mat/exiftool.py | 7 +++++-- mat/office.py | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/mat/exiftool.py b/mat/exiftool.py index 1d2d116..c6c1ada 100644 --- a/mat/exiftool.py +++ b/mat/exiftool.py @@ -32,13 +32,16 @@ class ExiftoolStripper(parser.GenericParser): ''' try: if self.backup: + # Note: '-All=' must be followed by a known exiftool option. process = subprocess.Popen(['exiftool', '-All=', '-out', self.output, self.filename], stdout=open('/dev/null')) process.wait() else: - process = subprocess.Popen(['exiftool', '-overwrite_original', - '-All=', self.filename], stdout=open('/dev/null')) + # Note: '-All=' must be followed by a known exiftool option. + process = subprocess.Popen( + [ 'exiftool', '-All=', '-overwrite_original', self.filename ], + stdout=open('/dev/null')) process.wait() return True except: diff --git a/mat/office.py b/mat/office.py index 2782318..41411c7 100644 --- a/mat/office.py +++ b/mat/office.py @@ -186,13 +186,16 @@ class PdfStripper(parser.GenericParser): try: # try with exiftool subprocess.Popen('exiftool', stdout=open('/dev/null')) import exiftool + # Note: '-All=' must be followed by a known exiftool option. if self.backup: process = subprocess.Popen(['exiftool', '-All=', '-out', self.output, self.filename], stdout=open('/dev/null')) process.wait() else: - process = subprocess.Popen(['exiftool', '-overwrite_original', - '-All=', self.filename], stdout=open('/dev/null')) + # Note: '-All=' must be followed by a known exiftool option. + process = subprocess.Popen( + ['exiftool', '-All=', '-overwrite_original', self.filename], + stdout=open('/dev/null')) process.wait() processed = True except: -- cgit v1.3