From 89a96b51758fdb226f5d0a582cf8ca091e38986a Mon Sep 17 00:00:00 2001 From: Simon Conseil Date: Thu, 17 Oct 2013 00:50:26 +0200 Subject: [PATCH] Add a setting for the video size (closes #35). --- sigal/gallery.py | 3 +-- sigal/settings.py | 43 ++++++++++++++++++----------------- sigal/templates/sigal.conf.py | 2 ++ 3 files changed, 25 insertions(+), 23 deletions(-) diff --git a/sigal/gallery.py b/sigal/gallery.py index ad61bcd..f3c78ae 100644 --- a/sigal/gallery.py +++ b/sigal/gallery.py @@ -316,8 +316,7 @@ def process_video(filepath, outpath, settings): copy(filepath, join(outpath, settings['orig_dir'], filename), symlink=settings['orig_link']) - # TODO: Add specific video size settings - video.generate_video(filepath, outname, settings['img_size'], + video.generate_video(filepath, outname, settings['video_size'], settings['webm_options']) if settings['make_thumbs']: diff --git a/sigal/settings.py b/sigal/settings.py index 7e0eea2..d6ae3ec 100644 --- a/sigal/settings.py +++ b/sigal/settings.py @@ -25,35 +25,36 @@ import logging import os _DEFAULT_CONFIG = { - 'source': '', - 'destination': '_build', - 'img_size': (640, 480), - 'img_processor': 'ResizeToFit', 'adjust_options': {'color': 1.0, 'brightness': 1.0, 'contrast': 1.0, 'sharpness': 1.0}, - 'make_thumbs': True, - 'thumb_prefix': '', - 'thumb_suffix': '', - 'thumb_size': (200, 150), - 'thumb_dir': 'thumbnails', - 'thumb_fit': True, + 'copy_exif_data': True, + 'copyright': '', + 'destination': '_build', + 'google_analytics': '', + 'img_ext_list': ['.jpg', '.jpeg', '.JPG', '.JPEG', '.png'], + 'img_processor': 'ResizeToFit', + 'img_size': (640, 480), + 'index_in_url': False, + 'jpg_options': {'quality': 85, 'optimize': True, 'progressive': True}, 'keep_orig': False, + 'links': '', + 'locale': '', + 'make_thumbs': True, 'orig_dir': 'original', 'orig_link': False, - 'jpg_options': {'quality': 85, 'optimize': True, 'progressive': True}, + 'source': '', + 'theme': 'colorbox', + 'thumb_dir': 'thumbnails', + 'thumb_fit': True, + 'thumb_prefix': '', + 'thumb_size': (200, 150), + 'thumb_suffix': '', + 'vid_ext_list': ['.MOV', '.mov', '.avi', '.mp4', '.webm', '.ogv'], + 'video_size': (480, 360), 'webm_options': {'crf': '10', 'bitrate': '1.6M', 'qmin': '4', 'qmax': '63'}, - 'copyright': '', - 'img_ext_list': ['.jpg', '.jpeg', '.JPG', '.JPEG', '.png'], - 'vid_ext_list': ['.MOV', '.mov', '.avi', '.mp4', '.webm', '.ogv'], - 'theme': 'colorbox', 'write_html': True, - 'index_in_url': False, 'zip_gallery': False, - 'links': '', - 'google_analytics': '', - 'copy_exif_data': True, - 'locale': '' } @@ -119,7 +120,7 @@ def read_settings(filename=None): settings_path, path))) logger.debug("Rewrite %s : %s -> %s", p, path, settings[p]) - for key in ('img_size', 'thumb_size'): + for key in ('img_size', 'thumb_size', 'video_size'): w, h = settings[key] if h > w: settings[key] = (h, w) diff --git a/sigal/templates/sigal.conf.py b/sigal/templates/sigal.conf.py index ef06ec0..5673f3c 100644 --- a/sigal/templates/sigal.conf.py +++ b/sigal/templates/sigal.conf.py @@ -75,6 +75,8 @@ thumb_size = (280, 210) # 'qmin': '4', # 'qmax': '63'} +# Size of resized video (default: (480, 360)) +# video_size = (480, 360) # Write HTML files. If False, sigal will only process the images. # write_html = True