diff options
Diffstat (limited to 'MAT')
| -rw-r--r-- | MAT/mat.py | 3 | ||||
| -rw-r--r-- | MAT/strippers.py | 13 |
2 files changed, 10 insertions, 6 deletions
| @@ -13,7 +13,6 @@ import xml.sax | |||
| 13 | import hachoir_core.cmd_line | 13 | import hachoir_core.cmd_line |
| 14 | import hachoir_parser | 14 | import hachoir_parser |
| 15 | 15 | ||
| 16 | import strippers | ||
| 17 | 16 | ||
| 18 | __version__ = '0.3.4' | 17 | __version__ = '0.3.4' |
| 19 | __author__ = 'jvoisin' | 18 | __author__ = 'jvoisin' |
| @@ -30,6 +29,8 @@ LOGGING_LEVEL = logging.DEBUG | |||
| 30 | 29 | ||
| 31 | logging.basicConfig(filename=fname, level=LOGGING_LEVEL) | 30 | logging.basicConfig(filename=fname, level=LOGGING_LEVEL) |
| 32 | 31 | ||
| 32 | import strippers # this is loaded here because we need LOGGING_LEVEL | ||
| 33 | |||
| 33 | def get_logo(): | 34 | def get_logo(): |
| 34 | if os.path.isfile('./data/mat.png'): | 35 | if os.path.isfile('./data/mat.png'): |
| 35 | return './data/mat.png' | 36 | return './data/mat.png' |
diff --git a/MAT/strippers.py b/MAT/strippers.py index 4279755..5eaf233 100644 --- a/MAT/strippers.py +++ b/MAT/strippers.py | |||
| @@ -7,8 +7,10 @@ import audio | |||
| 7 | import gi | 7 | import gi |
| 8 | import office | 8 | import office |
| 9 | import archive | 9 | import archive |
| 10 | import mat | ||
| 10 | import misc | 11 | import misc |
| 11 | import subprocess | 12 | import subprocess |
| 13 | import logging | ||
| 12 | 14 | ||
| 13 | STRIPPERS = { | 15 | STRIPPERS = { |
| 14 | 'application/x-tar': archive.TarStripper, | 16 | 'application/x-tar': archive.TarStripper, |
| @@ -20,25 +22,26 @@ STRIPPERS = { | |||
| 20 | 'application/officeopenxml': office.OpenXmlStripper, | 22 | 'application/officeopenxml': office.OpenXmlStripper, |
| 21 | } | 23 | } |
| 22 | 24 | ||
| 25 | logging.basicConfig(level=mat.LOGGING_LEVEL) | ||
| 23 | 26 | ||
| 24 | # PDF support | 27 | # PDF support |
| 25 | pdfSupport = True | 28 | pdfSupport = True |
| 26 | try: | 29 | try: |
| 27 | from gi.repository import Poppler | 30 | from gi.repository import Poppler |
| 28 | except ImportError: | 31 | except ImportError: |
| 29 | print('Unable to import Poppler') | 32 | logging.info('Unable to import Poppler: no PDF support') |
| 30 | pdfSupport = False | 33 | pdfSupport = False |
| 31 | 34 | ||
| 32 | try: | 35 | try: |
| 33 | import cairo | 36 | import cairo |
| 34 | except ImportError: | 37 | except ImportError: |
| 35 | print('Unable to import python-cairo: no PDF support') | 38 | logging.info('Unable to import python-cairo: no PDF support') |
| 36 | pdfSupport = False | 39 | pdfSupport = False |
| 37 | 40 | ||
| 38 | try: | 41 | try: |
| 39 | import pdfrw | 42 | import pdfrw |
| 40 | except ImportError: | 43 | except ImportError: |
| 41 | print('Unable to import python-pdfrw: no PDf support') | 44 | logging.info('Unable to import python-pdfrw: no PDf support') |
| 42 | pdfSupport = False | 45 | pdfSupport = False |
| 43 | 46 | ||
| 44 | if pdfSupport: | 47 | if pdfSupport: |
| @@ -53,7 +56,7 @@ try: | |||
| 53 | STRIPPERS['audio/vorbis'] = audio.OggStripper | 56 | STRIPPERS['audio/vorbis'] = audio.OggStripper |
| 54 | STRIPPERS['audio/mpeg'] = audio.MpegAudioStripper | 57 | STRIPPERS['audio/mpeg'] = audio.MpegAudioStripper |
| 55 | except ImportError: | 58 | except ImportError: |
| 56 | print('Unable to import python-mutagen: limited audio format support') | 59 | logging.info('Unable to import python-mutagen: limited audio format support') |
| 57 | 60 | ||
| 58 | # exiftool | 61 | # exiftool |
| 59 | try: | 62 | try: |
| @@ -62,6 +65,6 @@ try: | |||
| 62 | STRIPPERS['image/jpeg'] = exiftool.JpegStripper | 65 | STRIPPERS['image/jpeg'] = exiftool.JpegStripper |
| 63 | STRIPPERS['image/png'] = exiftool.PngStripper | 66 | STRIPPERS['image/png'] = exiftool.PngStripper |
| 64 | except OSError: # if exiftool is not installed, use hachoir instead | 67 | except OSError: # if exiftool is not installed, use hachoir instead |
| 65 | print('Unable to find exiftool: limited images support') | 68 | logging.info('Unable to find exiftool: limited images support') |
| 66 | STRIPPERS['image/jpeg'] = images.JpegStripper | 69 | STRIPPERS['image/jpeg'] = images.JpegStripper |
| 67 | STRIPPERS['image/png'] = images.PngStripper | 70 | STRIPPERS['image/png'] = images.PngStripper |
