|
@ -19,6 +19,7 @@ |
|
|
|
|
|
|
|
|
import os |
|
|
import os |
|
|
import io |
|
|
import io |
|
|
|
|
|
import sys |
|
|
import PyPDF2 |
|
|
import PyPDF2 |
|
|
import base64 |
|
|
import base64 |
|
|
import shutil |
|
|
import shutil |
|
@ -62,7 +63,7 @@ FORMATS = [ |
|
|
] |
|
|
] |
|
|
|
|
|
|
|
|
VIDEO_IMPORTS = [ |
|
|
VIDEO_IMPORTS = [ |
|
|
"mp4", "ogv", "webm" |
|
|
|
|
|
|
|
|
"mp4", "mov", "wav", "avi", "mpg", "flv", "wmv", "webm" |
|
|
] |
|
|
] |
|
|
|
|
|
|
|
|
PDF_IMPORTS = [ |
|
|
PDF_IMPORTS = [ |
|
@ -202,6 +203,9 @@ def create_thumbnail(binary, mimetype=None, filename=None, export="binary", form |
|
|
except Exception as e: |
|
|
except Exception as e: |
|
|
sys.exc_clear() |
|
|
sys.exc_clear() |
|
|
finally: |
|
|
finally: |
|
|
shutil.rmtree(tmp_dir) |
|
|
|
|
|
|
|
|
try: |
|
|
|
|
|
shutil.rmtree(tmp_dir) |
|
|
|
|
|
except PermissionError: |
|
|
|
|
|
_logger.warn("Temporary directory could not be deleted.") |
|
|
else: |
|
|
else: |
|
|
raise ValueError("No output could be generated.") |
|
|
raise ValueError("No output could be generated.") |