From 38106a5aeb7a318352949fae4f5b3e72e5e33254 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Sun, 28 Aug 2011 04:14:15 +0200 Subject: Preliminary binding to exiftool --- mat/exiftool.py | 20 ++++++++++++++++++++ mat/mat.py | 14 +++++++++++--- 2 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 mat/exiftool.py diff --git a/mat/exiftool.py b/mat/exiftool.py new file mode 100644 index 0000000..970ef3e --- /dev/null +++ b/mat/exiftool.py @@ -0,0 +1,20 @@ +''' + Care about images with help of the amazing (perl) library Exiftool. +''' + +import subprocess +import images +import parser + +class JpegStripper(parser.GenericParser): + ''' + Care about jpeg files with help + of exiftool + ''' + def remove_all(self): + ''' + Remove all metadata with help of exiftool + ''' + subprocess.Popen('exiftool -filename=%s -all= %s' % + (self.output, self.filename)) + diff --git a/mat/mat.py b/mat/mat.py index fd13287..50bb971 100644 --- a/mat/mat.py +++ b/mat/mat.py @@ -32,8 +32,6 @@ STRIPPERS = { 'application/x-bzip2': archive.Bzip2Stripper, 'application/zip': archive.ZipStripper, 'audio/mpeg': audio.MpegAudioStripper, - 'image/jpeg': images.JpegStripper, - 'image/png': images.PngStripper, 'application/x-bittorrent': misc.TorrentStripper, 'application/opendocument': office.OpenDocumentStripper, 'application/officeopenxml': office.OpenXmlStripper, @@ -53,7 +51,17 @@ try: STRIPPERS['audio/x-flac'] = audio.FlacStripper STRIPPERS['audio/vorbis'] = audio.OggStripper except ImportError: - print('unable to import python-mutagen : limited audio format support') + print('Unable to import python-mutagen: limited audio format support') + +try: + subprocess.Popen('exiftool_', stdout=open('/dev/null')) + import exiftool + #STRIPPERS['image/jpeg'] = exiftool.JpegStripper + #STRIPPERS['image/png'] = exiftool.PngStripper +except: + #print('Unable to find exiftool: limited images support') + STRIPPERS['image/jpeg'] = images.JpegStripper + STRIPPERS['image/png'] = images.PngStripper class XMLParser(xml.sax.handler.ContentHandler): -- cgit v1.3