added --tag option to build cache, now tags new images by default...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-12-19 05:36:03 +04:00
parent 04be56f096
commit f48102034b
2 changed files with 41 additions and 9 deletions

View File

@ -2,7 +2,7 @@
#=======================================================================
__version__ = '''0.0.01'''
__sub_version__ = '''20131026130132'''
__sub_version__ = '''20131219053320'''
__copyright__ = '''(c) Alex A. Naanou 2011'''
@ -50,6 +50,9 @@ CONFIG = {
'gid-source': 'original',
'base-ribbon': 0,
'tags': [
'unsorted',
],
'cache-image-name': '%(guid)s - %(name)s',
@ -498,6 +501,7 @@ def build_images(path, config=CONFIG, gid_generator=hash_gid, dry_run=False, ver
'name': name,
'type': 'image',
'state': 'single',
'tags': config.get('tags', []),
'orientation': {
0: 0,
1: 0,
@ -647,7 +651,8 @@ def build_data(images, path, config=CONFIG):
# High-level API...
#---------------------------------------------------------build_cache---
def build_cache(path, config=CONFIG, gid_generator=hash_gid,
report_progress=report_progress, dry_run=False, images_only=False, verbosity=0):
report_progress=report_progress, dry_run=False, images_only=False,
verbosity=0):
'''
NOTE: when updating existing cache, this will re-sort the images.
@ -832,6 +837,16 @@ def handle_commandline():
output_configuration.add_option('--base-ribbon',
default=CONFIG['base-ribbon'],
help='Base ribbon number (default: "%default").')
output_configuration.add_option('-t', '--tag',
action='append',
default=CONFIG['tags'][:],
help='add tag to each image (default: %default).',
metavar='TAG')
output_configuration.add_option('--notag',
action='append',
default=[],
help='do not add tag to images (default: %default).',
metavar='TAG')
output_configuration.add_option('--force-ascii',
action='store_true',
default=False,
@ -906,6 +921,9 @@ def handle_commandline():
'force-ascii': options.force_ascii,
})
# build the tags...
tags = config['tags'] = list(set(options.tag + config['tags']).difference(options.notag))
# a value from 0 through 2...
verbosity = options.verbosity
# bool...

View File

@ -13,12 +13,12 @@ var CONFIG = {
// Loader configuration...
//
// load_screens
// |<---------------------->|
// ooooooooooooXooooooooooooo
// |<----->|<------------>|
// ^ roll_frame
// load_threshold -+
// load_screens
// |<---------------------->|
// ribbon: ooooooooooooXooooooooooooo
// |<----->|<------------>|
// ^ roll_frame
// load_threshold -+
//
// number of screens to keep loaded...
//
@ -33,14 +33,28 @@ var CONFIG = {
// A threshold after which the image block ratio will be changed form
// 1x1 to 'fit-viewer' in single image mode...
//
// this can be:
// This can be:
// - null : feature disabled
// - number : discrete threshold
// - array of 2 numbers : two thresholds, in between the
// image proportions will transition
// gradually form square to screen
//
// When using array threshold, the gap between top and bottom must
// be at least a couple of zoom_step_scale's.
//
// NOTE: the array format, threshold order is not important.
// NOTE: setting this to an integer may have a side-effect of making
// zooming of images win opposite proportions to the viewer
// behave oddly on the threshold...
// ...usually looking line the image getting a bit smaller for
// a step while zooming in, or the opposite, this is normal.
// NOTE: array of two integers produces a barely noticeable
// side-effect of zooming being a bit uneven between the
// threshold values.
// this is due to the same reasons as for "jumping zoom"
// described above, and will be less noticeable the larger the
// gap between thresholds.
proportions_ratio_threshold: [
1.2,
2.5