More checks and logging for thumbnails (ref #71).
This commit is contained in:
@@ -132,6 +132,7 @@ class PathsDb(object):
|
||||
alb_thumb = self.db[path].setdefault('thumbnail', '')
|
||||
if alb_thumb and os.path.isfile(join(self.basepath, path,
|
||||
alb_thumb)):
|
||||
self.logger.debug("Thumb for %s : %s", path, alb_thumb)
|
||||
continue
|
||||
|
||||
for subdir in self.get_subdirs(path):
|
||||
@@ -140,6 +141,8 @@ class PathsDb(object):
|
||||
self.db[path]['thumbnail'] = join(
|
||||
os.path.relpath(subdir, path),
|
||||
self.db[subdir]['thumbnail'])
|
||||
self.logger.debug("Found thumb for %s : %s", path,
|
||||
self.db[path]['thumbnail'])
|
||||
break
|
||||
|
||||
if not self.db[path].get('thumbnail', ''):
|
||||
|
||||
@@ -176,18 +176,22 @@ class Writer(object):
|
||||
|
||||
# generate the thumbnail if it is missing (if
|
||||
# settings['make_thumbs'] is False)
|
||||
if not os.path.exists(thumb_path):
|
||||
if not os.path.isfile(thumb_path):
|
||||
source = os.path.join(self.output_dir, dpath, alb_thumb)
|
||||
ext = os.path.splitext(source)[1]
|
||||
self.logger.debug("Generating thumbnail for %s", source)
|
||||
|
||||
if ext in self.settings['img_ext_list']:
|
||||
generator = sigal.image.generate_thumbnail
|
||||
else:
|
||||
elif ext in self.settings['vid_ext_list']:
|
||||
generator = sigal.video.generate_thumbnail
|
||||
else:
|
||||
generator = None
|
||||
self.logger.error('Unsupported file type for %s', source)
|
||||
|
||||
generator(source, thumb_path, self.settings['thumb_size'],
|
||||
fit=self.settings['thumb_fit'])
|
||||
if generator:
|
||||
generator(source, thumb_path, self.settings['thumb_size'],
|
||||
fit=self.settings['thumb_fit'])
|
||||
|
||||
ctx['albums'].append({
|
||||
'url': d + '/' + self.url_ext,
|
||||
|
||||
Reference in New Issue
Block a user