diff -r 189f331c7960 -r 20355dd2e61a degal/commands.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/degal/commands.py Wed Jun 03 20:33:15 2009 +0300 @@ -0,0 +1,42 @@ +""" + Implementations of the core CLI commands +""" + +import log, shorturl, folder + +def main (dir='.', targets=()) : + """ + Scan the given root dir for all images, and render updated ones + """ + + root_filter = {} + + # parse the targets into the hierarchial root_filter that we use + for target in targets : + f = root_filter + for path_part in target.split('/') : + if path_part : + if path_part not in f : + f[path_part] = {} + + f = f[path_part] + + # build the index + log.title("Indexing %s...", dir) + root = folder.Folder(dir) + root.index(root_filter) + log.up() + + # XXX: maintain shorturls stuff + if False : + log.title("Syncing ShortURLs...") + shorturl.updateDB(root) + log.up() + + # render output + log.title("Rendering updated dirs...") + root.render() + log.up() + + return 0 +