summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorintrigeri2011-10-30 11:36:43 +0100
committerjvoisin2011-10-30 15:47:36 +0100
commitd3f09d95eb65bbb62a5598bcfcd3f727679ec074 (patch)
tree8009c7a4730a7dd015bdcebbf06c8e6e4a2373d6
parent390171cea314b21a08f236c3a5fc9b663ff53d7c (diff)
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.
-rw-r--r--mat/exiftool.py7
-rw-r--r--mat/office.py7
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):
32 ''' 32 '''
33 try: 33 try:
34 if self.backup: 34 if self.backup:
35 # Note: '-All=' must be followed by a known exiftool option.
35 process = subprocess.Popen(['exiftool', '-All=', 36 process = subprocess.Popen(['exiftool', '-All=',
36 '-out', self.output, self.filename], 37 '-out', self.output, self.filename],
37 stdout=open('/dev/null')) 38 stdout=open('/dev/null'))
38 process.wait() 39 process.wait()
39 else: 40 else:
40 process = subprocess.Popen(['exiftool', '-overwrite_original', 41 # Note: '-All=' must be followed by a known exiftool option.
41 '-All=', self.filename], stdout=open('/dev/null')) 42 process = subprocess.Popen(
43 [ 'exiftool', '-All=', '-overwrite_original', self.filename ],
44 stdout=open('/dev/null'))
42 process.wait() 45 process.wait()
43 return True 46 return True
44 except: 47 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):
186 try: # try with exiftool 186 try: # try with exiftool
187 subprocess.Popen('exiftool', stdout=open('/dev/null')) 187 subprocess.Popen('exiftool', stdout=open('/dev/null'))
188 import exiftool 188 import exiftool
189 # Note: '-All=' must be followed by a known exiftool option.
189 if self.backup: 190 if self.backup:
190 process = subprocess.Popen(['exiftool', '-All=', 191 process = subprocess.Popen(['exiftool', '-All=',
191 '-out', self.output, self.filename], stdout=open('/dev/null')) 192 '-out', self.output, self.filename], stdout=open('/dev/null'))
192 process.wait() 193 process.wait()
193 else: 194 else:
194 process = subprocess.Popen(['exiftool', '-overwrite_original', 195 # Note: '-All=' must be followed by a known exiftool option.
195 '-All=', self.filename], stdout=open('/dev/null')) 196 process = subprocess.Popen(
197 ['exiftool', '-All=', '-overwrite_original', self.filename],
198 stdout=open('/dev/null'))
196 process.wait() 199 process.wait()
197 processed = True 200 processed = True
198 except: 201 except: