diff options
| author | jvoisin | 2011-07-29 19:18:37 +0200 |
|---|---|---|
| committer | jvoisin | 2011-07-29 19:18:37 +0200 |
| commit | 8f889fead81b2046d289402b831e18f8ddb00276 (patch) | |
| tree | c65736ba7f1b79b76aed9cac7e06317e1fb61f00 /lib/mat.py | |
| parent | 4ce3a446bb7d053962053895195e0feab18160a4 (diff) | |
preliminary clean/smooth support of pdf files, with help of poppler and cairo
Diffstat (limited to 'lib/mat.py')
| -rw-r--r-- | lib/mat.py | 11 |
1 files changed, 10 insertions, 1 deletions
| @@ -32,11 +32,18 @@ STRIPPERS = { | |||
| 32 | 'audio/mpeg': audio.MpegAudioStripper, | 32 | 'audio/mpeg': audio.MpegAudioStripper, |
| 33 | 'image/jpeg': images.JpegStripper, | 33 | 'image/jpeg': images.JpegStripper, |
| 34 | 'image/png': images.PngStripper, | 34 | 'image/png': images.PngStripper, |
| 35 | 'application/x-pdf ': office.PdfStripper, | ||
| 36 | 'application/vnd.oasis.opendocument': office.OpenDocumentStripper, | 35 | 'application/vnd.oasis.opendocument': office.OpenDocumentStripper, |
| 37 | } | 36 | } |
| 38 | 37 | ||
| 39 | try: | 38 | try: |
| 39 | import poppler | ||
| 40 | import cairo | ||
| 41 | STRIPPERS['application/x-pdf'] = office.PdfStripper | ||
| 42 | STRIPPERS['application/pdf'] = office.PdfStripper | ||
| 43 | except ImportError: | ||
| 44 | print('Unable to import python-poppler and/or python-cairo: no pdf support') | ||
| 45 | |||
| 46 | try: | ||
| 40 | import mutagen | 47 | import mutagen |
| 41 | STRIPPERS['audio/x-flac'] = audio.FlacStripper | 48 | STRIPPERS['audio/x-flac'] = audio.FlacStripper |
| 42 | STRIPPERS['audio/x-ape'] = audio.Apev2Stripper | 49 | STRIPPERS['audio/x-ape'] = audio.Apev2Stripper |
| @@ -100,6 +107,8 @@ def create_class_file(name, backup, add2archive): | |||
| 100 | if mime.startswith('application/vnd.oasis.opendocument'): | 107 | if mime.startswith('application/vnd.oasis.opendocument'): |
| 101 | mime = 'application/vnd.oasis.opendocument' # opendocument fileformat | 108 | mime = 'application/vnd.oasis.opendocument' # opendocument fileformat |
| 102 | 109 | ||
| 110 | #stripper_class = STRIPPERS[mime] | ||
| 111 | |||
| 103 | try: | 112 | try: |
| 104 | stripper_class = STRIPPERS[mime] | 113 | stripper_class = STRIPPERS[mime] |
| 105 | except KeyError: | 114 | except KeyError: |
