equal
deleted
inserted
replaced
21 # |
21 # |
22 |
22 |
23 import os.path, os |
23 import os.path, os |
24 from optparse import OptionParser |
24 from optparse import OptionParser |
25 |
25 |
26 from lib import folder, shorturl |
26 from lib import folder, shorturl, log |
27 |
27 |
28 def main (dir='.', targets=()) : |
28 def main (dir='.', targets=()) : |
29 root_filter = {} |
29 root_filter = {} |
30 |
30 |
31 for target in targets : |
31 for target in targets : |
34 if path_part : |
34 if path_part : |
35 if path_part not in f : |
35 if path_part not in f : |
36 f[path_part] = {} |
36 f[path_part] = {} |
37 |
37 |
38 f = f[path_part] |
38 f = f[path_part] |
39 |
39 |
|
40 log.title("Indexing %s...", dir) |
40 root = folder.Folder(dir) |
41 root = folder.Folder(dir) |
41 root.index(root_filter) |
42 root.index(root_filter) |
|
43 log.up() |
|
44 |
|
45 log.title("Syncing ShortURLs...") |
42 shorturl.updateDB(root) |
46 shorturl.updateDB(root) |
|
47 log.up() |
|
48 |
|
49 log.title("Rendering updated dirs...") |
43 root.render() |
50 root.render() |
|
51 log.up() |
44 |
52 |
45 if __name__ == '__main__' : |
53 if __name__ == '__main__' : |
46 parser = OptionParser(usage="usage: %prog [options] ... [target ...]") |
54 parser = OptionParser(usage="usage: %prog [options] ... [target ...]") |
47 |
55 |
48 parser.add_option("-d", "--dir", dest="dir", help="look for images in DIR and write the HTML there", metavar="DIR", default=".") |
56 parser.add_option("-d", "--dir", dest="dir", help="look for images in DIR and write the HTML there", metavar="DIR", default=".") |