diff --git a/sigal/image.py b/sigal/image.py index 58d2752..31494bb 100644 --- a/sigal/image.py +++ b/sigal/image.py @@ -159,7 +159,10 @@ def process_image(filepath, outpath, settings): fit=settings['thumb_fit'], options=options) except Exception as e: logger.info('Failed to process: %r', e) - return Status.FAILURE + if logger.getEffectiveLevel() == logging.DEBUG: + raise + else: + return Status.FAILURE return Status.SUCCESS diff --git a/sigal/video.py b/sigal/video.py index 41cc360..d120aa9 100644 --- a/sigal/video.py +++ b/sigal/video.py @@ -133,11 +133,7 @@ def generate_thumbnail(source, outname, box, delay, fit=True, options=None): cmd = ['ffmpeg', '-i', source, '-an', '-r', '1', '-ss', delay, '-vframes', '1', '-y', tmpfile] logger.debug('Create thumbnail for video: %s', ' '.join(cmd)) - - try: - check_subprocess(cmd, source, outname) - except Exception: - return + check_subprocess(cmd, source, outname) # use the generate_thumbnail function from sigal.image image.generate_thumbnail(tmpfile, outname, box, fit, options) @@ -169,7 +165,10 @@ def process_video(filepath, outpath, settings): generate_video(filepath, outname, settings, options=settings.get(video_format + '_options')) except Exception: - return Status.FAILURE + if logger.getEffectiveLevel() == logging.DEBUG: + raise + else: + return Status.FAILURE if settings['make_thumbs']: thumb_name = os.path.join(outpath, get_thumb(settings, filename)) @@ -179,6 +178,9 @@ def process_video(filepath, outpath, settings): settings['thumb_video_delay'], fit=settings['thumb_fit'], options=settings['jpg_options']) except Exception: - return Status.FAILURE + if logger.getEffectiveLevel() == logging.DEBUG: + raise + else: + return Status.FAILURE return Status.SUCCESS diff --git a/tests/test_gallery.py b/tests/test_gallery.py index 066a739..865eceb 100644 --- a/tests/test_gallery.py +++ b/tests/test_gallery.py @@ -1,12 +1,14 @@ # -*- coding:utf-8 -*- import locale +import logging import os import pytest import datetime from os.path import join from sigal.gallery import Album, Media, Image, Video, Gallery +from sigal.video import SubprocessException CURRENT_DIR = os.path.dirname(__file__) @@ -218,6 +220,8 @@ def test_gallery(settings, tmpdir): "Test the Gallery class." settings['destination'] = str(tmpdir) + settings['webm_options'] = ['-missing-option', 'foobar'] + gal = Gallery(settings, ncpu=1) gal.build() @@ -229,6 +233,11 @@ def test_gallery(settings, tmpdir): assert '