removed duplicative tumbnail creation that broke pelican workflow. fixes #17

This commit is contained in:
Scott Boone (github signing key) 2014-10-17 17:00:56 -05:00
parent 826e8567f5
commit cae0ac62f1
2 changed files with 7 additions and 25 deletions

View file

@ -38,8 +38,6 @@ from PIL import Image as PILImage
from .compat import strxfrm, UnicodeMixin, url_quote
from .utils import read_markdown, url_from_path
from .image import process_image, get_exif_tags
from .image import generate_thumbnail as generate_img_thumb
from .video import generate_thumbnail as generate_vid_thumb
class Media(UnicodeMixin):
"""Base Class for media files.
@ -86,22 +84,7 @@ class Media(UnicodeMixin):
@property
def thumbnail(self):
"""Path to the thumbnail image (relative to the album directory)."""
if not os.path.isfile(self.thumb_path):
# if thumbnail is missing (if settings['make_thumbs'] is False)
if self.type == 'image':
generator = generate_img_thumb
elif self.type == 'video':
generator = generate_vid_thumb
self.logger.debug('siglican: Generating thumbnail for %r', self)
try:
generator(self.src_path, self.thumb_path,
self.settings['SIGLICAN_THUMB_SIZE'],
fit=self.settings['SIGLICAN_THUMB_FIT'])
except Exception as e:
self.logger.error('siglican: Failed to generate thumbnail: %s', e)
return
# cleanup: make this deal better with SIGLICAN_MAKE_THUMBS: False
return url_from_path(self.thumb_name)
def _get_metadata(self):

View file

@ -57,7 +57,7 @@ _DEFAULT_SIGLICAN_SETTINGS = {
'SIGLICAN_LOCALE': '',
'SIGLICAN_MEDIAS_SORT_ATTR': 'filename',
'SIGLICAN_MEDIAS_SORT_REVERSE': False,
'SIGLICAN_MAKE_THUMBS': True,
# 'SIGLICAN_MAKE_THUMBS': True,
'SIGLICAN_ORIG_DIR': 'original',
'SIGLICAN_ORIG_LINK': False,
# 'PLUGINS': [],
@ -167,7 +167,7 @@ class SigalGalleryGenerator(Generator):
logger.debug('siglican: Files before filtering: %r', files)
files = [os.path.split(f)[1] for f in files_path]
logger.debug('siglican: Files after filtering: %r', files)
# Remove sub-directories that have been ignored in a previous
# iteration (as topdown=False, sub-directories are processed before
# their parent
@ -175,25 +175,24 @@ class SigalGalleryGenerator(Generator):
path = os.path.join(relpath, d) if relpath != '.' else d
if path not in self.albums.keys():
dirs.remove(d)
album = Album(relpath, self.settings, dirs, files, self)
if not album.medias and not album.albums:
logger.info('siglican: Skip empty album: %r', album)
else:
self.albums[relpath] = album
# done generating context (self.albums) now
logger.debug('siglican: albums:\n%r', self.albums.values())
# update the jinja context so that templates can access it:
#self._update_context(('albums', )) # unnecessary? **
self.context['ALBUMS'] = self.albums # ** change to SIGLICAN_ALBUMS?
# update the jinja context with the default sigal settings:
for k,v in _DEFAULT_SIGLICAN_SETTINGS.iteritems():
if not k in self.context:
self.context[k] = v
def generate_output(self, writer):
""" Creates gallery destination directories, thumbnails, resized
images, and moves everything into the destination."""