summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mat/exiftool.py20
-rw-r--r--mat/mat.py14
2 files changed, 31 insertions, 3 deletions
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 @@
1'''
2 Care about images with help of the amazing (perl) library Exiftool.
3'''
4
5import subprocess
6import images
7import parser
8
9class JpegStripper(parser.GenericParser):
10 '''
11 Care about jpeg files with help
12 of exiftool
13 '''
14 def remove_all(self):
15 '''
16 Remove all metadata with help of exiftool
17 '''
18 subprocess.Popen('exiftool -filename=%s -all= %s' %
19 (self.output, self.filename))
20
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 = {
32 'application/x-bzip2': archive.Bzip2Stripper, 32 'application/x-bzip2': archive.Bzip2Stripper,
33 'application/zip': archive.ZipStripper, 33 'application/zip': archive.ZipStripper,
34 'audio/mpeg': audio.MpegAudioStripper, 34 'audio/mpeg': audio.MpegAudioStripper,
35 'image/jpeg': images.JpegStripper,
36 'image/png': images.PngStripper,
37 'application/x-bittorrent': misc.TorrentStripper, 35 'application/x-bittorrent': misc.TorrentStripper,
38 'application/opendocument': office.OpenDocumentStripper, 36 'application/opendocument': office.OpenDocumentStripper,
39 'application/officeopenxml': office.OpenXmlStripper, 37 'application/officeopenxml': office.OpenXmlStripper,
@@ -53,7 +51,17 @@ try:
53 STRIPPERS['audio/x-flac'] = audio.FlacStripper 51 STRIPPERS['audio/x-flac'] = audio.FlacStripper
54 STRIPPERS['audio/vorbis'] = audio.OggStripper 52 STRIPPERS['audio/vorbis'] = audio.OggStripper
55except ImportError: 53except ImportError:
56 print('unable to import python-mutagen : limited audio format support') 54 print('Unable to import python-mutagen: limited audio format support')
55
56try:
57 subprocess.Popen('exiftool_', stdout=open('/dev/null'))
58 import exiftool
59 #STRIPPERS['image/jpeg'] = exiftool.JpegStripper
60 #STRIPPERS['image/png'] = exiftool.PngStripper
61except:
62 #print('Unable to find exiftool: limited images support')
63 STRIPPERS['image/jpeg'] = images.JpegStripper
64 STRIPPERS['image/png'] = images.PngStripper
57 65
58 66
59class XMLParser(xml.sax.handler.ContentHandler): 67class XMLParser(xml.sax.handler.ContentHandler):