Browse Source

Add failed files to the cli summary.

pull/113/merge
Simon Conseil 12 years ago
parent
commit
5215451d96
  1. 15
      sigal/__init__.py
  2. 4
      sigal/gallery.py

15
sigal/__init__.py

@ -139,9 +139,18 @@ def build(source, destination, debug, verbose, force, config, theme, title,
logger.debug('Copy %s to %s', src, dst)
copy(src, dst, symlink=settings['orig_link'])
print(('Done.\nProcessed {image} images ({image_skipped} skipped) and '
'{video} videos ({video_skipped} skipped) in {duration:.2f} '
'seconds.').format(duration=time.time() - start_time, **gal.stats))
stats = gal.stats
def format_stats(_type):
opt = ["{} {}".format(stats[_type + '_' + subtype], subtype)
for subtype in ('skipped', 'failed')
if stats[_type + '_' + subtype] > 0]
opt = ' ({})'.format(', '.join(opt)) if opt else ''
return '{} {}s{}'.format(stats[_type], _type, opt)
print('Done.\nProcessed {} and {} in {:.2f} seconds.'
.format(format_stats('image'), format_stats('video'),
time.time() - start_time))
def init_plugins(settings):

4
sigal/gallery.py

@ -468,8 +468,7 @@ class Gallery(object):
def __init__(self, settings, ncpu=None):
self.settings = settings
self.logger = logging.getLogger(__name__)
self.stats = {'image': 0, 'image_skipped': 0,
'video': 0, 'video_skipped': 0}
self.stats = defaultdict(int)
self.init_pool(ncpu)
check_or_create_dir(settings['destination'])
@ -638,6 +637,7 @@ class Gallery(object):
album = self.albums[path]
for f in album.medias:
if f.filename == filename:
self.stats[f.type + '_failed'] += 1
album.medias.remove(f)
break
self.logger.error('You can run sigal in verbose (--verbose) or debug '

Loading…
Cancel
Save