diff --git a/.gitignore b/.gitignore index d70f6db..dd77799 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ nose.cfg MANIFEST _build/ +build/ dist/ docs/_build htmlcov/ diff --git a/AUTHORS b/AUTHORS new file mode 100644 index 0000000..14a185f --- /dev/null +++ b/AUTHORS @@ -0,0 +1,6 @@ +Sigal is written and maintained by Simon Conseil and contributors (in +alphabetical order): + +- Christophe-Marie Duquesne +- Matthias Vogelgesang +- Yuce Tekol diff --git a/README.rst b/README.rst index 3746452..0a73abf 100644 --- a/README.rst +++ b/README.rst @@ -14,12 +14,19 @@ and it allows to build a static gallery of images with the following features: * Themes support. * MIT licensed. +The idea behind Sigal is to ease the use of the javascript librairies like +`galleria`_. These librairies do a great job to display the images, Sigal does +what is missing: resize images, create thumbnails, generate html pages. + +Sigal is currently compatible only with Python 2. + Links : * Latest documentation on the `website`_ * Source, issues and pull requests on `Github`_ * Releases on `PyPI`_ +.. _galleria: http://galleria.io/ .. _website: http://sigal.saimon.org/ .. _Github: https://github.com/saimn/sigal/ .. _PyPI: http://pypi.python.org/pypi/sigal diff --git a/docs/index.rst b/docs/index.rst index fd71bea..3e1f475 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -1,31 +1,4 @@ -======================================= -Sigal - Simple Static Gallery Generator -======================================= - -Sigal is yet another simple static gallery generator. It's written in Python -and it allows to build a static gallery of images with the following features: - -* Process directories recursively. -* Generate HTML pages using jinja2 templates. -* Relative links for a portable output. -* Themes support. -* MIT licensed. - -The idea behind Sigal is to ease the use of the javascript librairies like -`galleria`_. These librairies do a great job to display the images, Sigal does -what is missing: resize images, create thumbnails, generate html pages. - -Sigal is currently compatible only with python 2. - -Links : - -* Latest documentation on the `website`_ -* Source, issues and pull requests on `Github`_ -* Releases on `PyPI`_ - -.. _website: http://sigal.saimon.org/ -.. _Github: https://github.com/saimn/sigal/ -.. _PyPI: http://pypi.python.org/pypi/sigal +.. include:: ../README.rst Themes & Demo ------------- diff --git a/setup.py b/setup.py index 92087e1..1b98e1a 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ # -*- coding:utf-8 -*- import os -from setuptools import setup, find_packages +from setuptools import setup requires = ['argh', 'clint', 'jinja2', 'Markdown', 'pilkit'] diff --git a/sigal/__init__.py b/sigal/__init__.py index 89e756b..c4e1ec4 100644 --- a/sigal/__init__.py +++ b/sigal/__init__.py @@ -41,7 +41,7 @@ from argh import ArghParser, arg from logging import Formatter from .gallery import Gallery -from .pkgmeta import * +from .pkgmeta import __version__ from .settings import read_settings _DEFAULT_CONFIG_FILE = 'sigal.conf.py' diff --git a/sigal/gallery.py b/sigal/gallery.py index a136839..0fdecd1 100644 --- a/sigal/gallery.py +++ b/sigal/gallery.py @@ -43,10 +43,12 @@ from .writer import Writer DESCRIPTION_FILE = "index.md" + class FileExtensionError(Exception): """Raised if we made an error when handling file extensions""" pass + class PathsDb(object): """Container for all the information on the directory structure. @@ -75,7 +77,7 @@ class PathsDb(object): subdir = [os.path.normpath(os.path.join(path, sub)) for sub in self.db[path].get('subdir', [])] if subdir: - return subdir + reduce(lambda x, y: x+y, + return subdir + reduce(lambda x, y: x + y, map(self.get_subdirs, subdir)) else: return [] @@ -108,7 +110,7 @@ class PathsDb(object): path_media = [path for path in self.db['paths_list'] if self.db[path]['medias'] and path != '.'] path_nomedia = [path for path in self.db['paths_list'] - if not self.db[path]['medias'] and path !='.'] + if not self.db[path]['medias'] and path != '.'] # dir with images: check the thumbnail, and find it if necessary for path in path_media: @@ -190,8 +192,9 @@ class Gallery(object): # loop on directories in reversed order, to process subdirectories # before their parent for path in reversed(self.db['paths_list']): - media_files = [os.path.normpath(join(self.settings['source'], path, f)) - for f in self.db[path]['medias']] + source = self.settings['source'] + media_files = [os.path.normpath(join(source, path, f)) + for f in self.db[path]['medias']] # output dir for the current path outpath = os.path.normpath(join(self.settings['destination'], @@ -293,6 +296,7 @@ def process_image(filepath, outpath, settings): settings['thumb_size'], None, fit=settings['thumb_fit'], options=options) + def process_video(filepath, outpath, settings): """Process one image: resize, create thumbnail.""" diff --git a/sigal/settings.py b/sigal/settings.py index a68359f..e3ea0e5 100644 --- a/sigal/settings.py +++ b/sigal/settings.py @@ -38,7 +38,8 @@ _DEFAULT_CONFIG = { 'keep_orig': False, 'orig_dir': 'original', 'jpg_options': {'quality': 85, 'optimize': True, 'progressive': True}, - 'webm_options': {'crf': '10', 'bitrate': '1.6M', 'qmin': '4', 'qmax': '63'}, + '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'], diff --git a/sigal/video.py b/sigal/video.py index a806d11..9b7d947 100644 --- a/sigal/video.py +++ b/sigal/video.py @@ -27,6 +27,7 @@ import re import shutil import sigal.image + def vid_size(source): """Returns the dimensions of the video""" pattern = re.compile(r'Stream.*Video.* ([0-9]+)x([0-9]+)') @@ -84,6 +85,7 @@ def generate_video(source, outname, size, options={}): resize_opt + [outname], stderr=devnull) + def generate_thumbnail(source, outname, box, format, fit=True, options=None): "Create a thumbnail image" # 1) dump an image of the video