summaryrefslogtreecommitdiff
path: root/lib/strippers.py
diff options
context:
space:
mode:
Diffstat (limited to 'lib/strippers.py')
-rw-r--r--lib/strippers.py30
1 files changed, 24 insertions, 6 deletions
diff --git a/lib/strippers.py b/lib/strippers.py
index dfdf1ea..61030a7 100644
--- a/lib/strippers.py
+++ b/lib/strippers.py
@@ -20,24 +20,42 @@ STRIPPERS = {
20 'application/officeopenxml': office.OpenXmlStripper, 20 'application/officeopenxml': office.OpenXmlStripper,
21} 21}
22 22
23try: # PDF support 23
24# PDF support
25pdfSupport = True
26try:
24 import poppler 27 import poppler
28except ImportError:
29 print('Unable to import python-poppler: not PDF support')
30 pdfSupport = False
31
32try:
25 import cairo 33 import cairo
34except ImportError:
35 print('Unable to import python-cairo: no PDF support')
36 pdfSupport = False
37
38try:
26 import pdfrw 39 import pdfrw
40except ImportError:
41 print('Unable to import python-pdfrw: no PDf support')
42 pdfSupport = False
43
44if pdfSupport:
27 STRIPPERS['application/x-pdf'] = office.PdfStripper 45 STRIPPERS['application/x-pdf'] = office.PdfStripper
28 STRIPPERS['application/pdf'] = office.PdfStripper 46 STRIPPERS['application/pdf'] = office.PdfStripper
29except ImportError:
30 print('Unable to import python-poppler and/or python-cairo \
31and/or pdfrw: no PDF support')
32 47
33try: # mutangen-python : audio format support 48
49# audio format support with mutagen-python
50try:
34 import mutagen 51 import mutagen
35 STRIPPERS['audio/x-flac'] = audio.FlacStripper 52 STRIPPERS['audio/x-flac'] = audio.FlacStripper
36 STRIPPERS['audio/vorbis'] = audio.OggStripper 53 STRIPPERS['audio/vorbis'] = audio.OggStripper
37except ImportError: 54except ImportError:
38 print('Unable to import python-mutagen: limited audio format support') 55 print('Unable to import python-mutagen: limited audio format support')
39 56
40try: # check if exiftool is installed on the system 57# exiftool
58try:
41 subprocess.Popen('exiftool', stdout=open('/dev/null')) 59 subprocess.Popen('exiftool', stdout=open('/dev/null'))
42 import exiftool 60 import exiftool
43 STRIPPERS['image/jpeg'] = exiftool.JpegStripper 61 STRIPPERS['image/jpeg'] = exiftool.JpegStripper