removed duplicative tumbnail creation that broke pelican workflow. fixes #17
This commit is contained in:
parent
826e8567f5
commit
cae0ac62f1
2 changed files with 7 additions and 25 deletions
19
album.py
19
album.py
|
@ -38,8 +38,6 @@ from PIL import Image as PILImage
|
||||||
from .compat import strxfrm, UnicodeMixin, url_quote
|
from .compat import strxfrm, UnicodeMixin, url_quote
|
||||||
from .utils import read_markdown, url_from_path
|
from .utils import read_markdown, url_from_path
|
||||||
from .image import process_image, get_exif_tags
|
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):
|
class Media(UnicodeMixin):
|
||||||
"""Base Class for media files.
|
"""Base Class for media files.
|
||||||
|
@ -86,22 +84,7 @@ class Media(UnicodeMixin):
|
||||||
@property
|
@property
|
||||||
def thumbnail(self):
|
def thumbnail(self):
|
||||||
"""Path to the thumbnail image (relative to the album directory)."""
|
"""Path to the thumbnail image (relative to the album directory)."""
|
||||||
|
# cleanup: make this deal better with SIGLICAN_MAKE_THUMBS: False
|
||||||
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
|
|
||||||
return url_from_path(self.thumb_name)
|
return url_from_path(self.thumb_name)
|
||||||
|
|
||||||
def _get_metadata(self):
|
def _get_metadata(self):
|
||||||
|
|
13
siglican.py
13
siglican.py
|
@ -57,7 +57,7 @@ _DEFAULT_SIGLICAN_SETTINGS = {
|
||||||
'SIGLICAN_LOCALE': '',
|
'SIGLICAN_LOCALE': '',
|
||||||
'SIGLICAN_MEDIAS_SORT_ATTR': 'filename',
|
'SIGLICAN_MEDIAS_SORT_ATTR': 'filename',
|
||||||
'SIGLICAN_MEDIAS_SORT_REVERSE': False,
|
'SIGLICAN_MEDIAS_SORT_REVERSE': False,
|
||||||
'SIGLICAN_MAKE_THUMBS': True,
|
# 'SIGLICAN_MAKE_THUMBS': True,
|
||||||
'SIGLICAN_ORIG_DIR': 'original',
|
'SIGLICAN_ORIG_DIR': 'original',
|
||||||
'SIGLICAN_ORIG_LINK': False,
|
'SIGLICAN_ORIG_LINK': False,
|
||||||
# 'PLUGINS': [],
|
# 'PLUGINS': [],
|
||||||
|
@ -167,7 +167,7 @@ class SigalGalleryGenerator(Generator):
|
||||||
logger.debug('siglican: Files before filtering: %r', files)
|
logger.debug('siglican: Files before filtering: %r', files)
|
||||||
files = [os.path.split(f)[1] for f in files_path]
|
files = [os.path.split(f)[1] for f in files_path]
|
||||||
logger.debug('siglican: Files after filtering: %r', files)
|
logger.debug('siglican: Files after filtering: %r', files)
|
||||||
|
|
||||||
# Remove sub-directories that have been ignored in a previous
|
# Remove sub-directories that have been ignored in a previous
|
||||||
# iteration (as topdown=False, sub-directories are processed before
|
# iteration (as topdown=False, sub-directories are processed before
|
||||||
# their parent
|
# their parent
|
||||||
|
@ -175,25 +175,24 @@ class SigalGalleryGenerator(Generator):
|
||||||
path = os.path.join(relpath, d) if relpath != '.' else d
|
path = os.path.join(relpath, d) if relpath != '.' else d
|
||||||
if path not in self.albums.keys():
|
if path not in self.albums.keys():
|
||||||
dirs.remove(d)
|
dirs.remove(d)
|
||||||
|
|
||||||
album = Album(relpath, self.settings, dirs, files, self)
|
album = Album(relpath, self.settings, dirs, files, self)
|
||||||
|
|
||||||
if not album.medias and not album.albums:
|
if not album.medias and not album.albums:
|
||||||
logger.info('siglican: Skip empty album: %r', album)
|
logger.info('siglican: Skip empty album: %r', album)
|
||||||
else:
|
else:
|
||||||
self.albums[relpath] = album
|
self.albums[relpath] = album
|
||||||
# done generating context (self.albums) now
|
# done generating context (self.albums) now
|
||||||
logger.debug('siglican: albums:\n%r', self.albums.values())
|
logger.debug('siglican: albums:\n%r', self.albums.values())
|
||||||
|
|
||||||
# update the jinja context so that templates can access it:
|
# update the jinja context so that templates can access it:
|
||||||
#self._update_context(('albums', )) # unnecessary? **
|
#self._update_context(('albums', )) # unnecessary? **
|
||||||
self.context['ALBUMS'] = self.albums # ** change to SIGLICAN_ALBUMS?
|
self.context['ALBUMS'] = self.albums # ** change to SIGLICAN_ALBUMS?
|
||||||
|
|
||||||
# update the jinja context with the default sigal settings:
|
# update the jinja context with the default sigal settings:
|
||||||
for k,v in _DEFAULT_SIGLICAN_SETTINGS.iteritems():
|
for k,v in _DEFAULT_SIGLICAN_SETTINGS.iteritems():
|
||||||
if not k in self.context:
|
if not k in self.context:
|
||||||
self.context[k] = v
|
self.context[k] = v
|
||||||
|
|
||||||
def generate_output(self, writer):
|
def generate_output(self, writer):
|
||||||
""" Creates gallery destination directories, thumbnails, resized
|
""" Creates gallery destination directories, thumbnails, resized
|
||||||
images, and moves everything into the destination."""
|
images, and moves everything into the destination."""
|
||||||
|
|
Loading…
Reference in a new issue