diff options
| author | jvoisin | 2013-07-16 21:56:26 +0200 |
|---|---|---|
| committer | jvoisin | 2013-07-16 22:07:37 +0200 |
| commit | 5bd67641e879dc2b99f50ebad352c75295c23812 (patch) | |
| tree | 8176e1ba04a958a803b8828e2dbdc0e436b6384d /MAT/exiftool.py | |
| parent | c67f5944c4a0df936a3a32eca40a0ac1ba9a95a7 (diff) | |
Improve/bugfix exiftool handling
- Exiftool handle more effeciently adobe metadata
- Fix exiftool's handling due to recent refactoring
Diffstat (limited to 'MAT/exiftool.py')
| -rw-r--r-- | MAT/exiftool.py | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/MAT/exiftool.py b/MAT/exiftool.py index d3c5b2a..1cae352 100644 --- a/MAT/exiftool.py +++ b/MAT/exiftool.py | |||
| @@ -4,6 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | import subprocess | 5 | import subprocess |
| 6 | import parser | 6 | import parser |
| 7 | import shutil | ||
| 7 | 8 | ||
| 8 | 9 | ||
| 9 | class ExiftoolStripper(parser.GenericParser): | 10 | class ExiftoolStripper(parser.GenericParser): |
| @@ -31,17 +32,12 @@ class ExiftoolStripper(parser.GenericParser): | |||
| 31 | ''' | 32 | ''' |
| 32 | try: | 33 | try: |
| 33 | if self.backup: | 34 | if self.backup: |
| 34 | # Note: '-All=' must be followed by a known exiftool option. | 35 | shutil.copy2(self.filename, self.filename + '.bak') |
| 35 | process = subprocess.Popen(['exiftool', '-m', '-All=', | 36 | # Note: '-All=' must be followed by a known exiftool option. |
| 36 | '-out', self.output, self.filename], | 37 | process = subprocess.Popen( ['exiftool', '-m', '-all=', |
| 37 | stdout=open('/dev/null')) | 38 | '-adobe=', '-overwrite_original', self.filename ], |
| 38 | process.wait() | 39 | stdout=open('/dev/null')) |
| 39 | else: | 40 | process.wait() |
| 40 | # Note: '-All=' must be followed by a known exiftool option. | ||
| 41 | process = subprocess.Popen( | ||
| 42 | [ 'exiftool', '-m', '-All=', '-overwrite_original', self.filename ], | ||
| 43 | stdout=open('/dev/null')) | ||
| 44 | process.wait() | ||
| 45 | return True | 41 | return True |
| 46 | except: | 42 | except: |
| 47 | return False | 43 | return False |
| @@ -94,4 +90,5 @@ class PngStripper(ExiftoolStripper): | |||
| 94 | def _set_allowed(self): | 90 | def _set_allowed(self): |
| 95 | self.allowed.extend(['Bit Depth', 'Color Type', 'Compression', | 91 | self.allowed.extend(['Bit Depth', 'Color Type', 'Compression', |
| 96 | 'Filter', 'Interlace', 'Pixels Per Unit X', 'Pixels Per Unit Y', | 92 | 'Filter', 'Interlace', 'Pixels Per Unit X', 'Pixels Per Unit Y', |
| 97 | 'Pixel Units']) | 93 | 'Pixel Units', 'Significant Bits' ,'Background Color', |
| 94 | 'SRGB Rendering',]) | ||
