2 """Run through the bookmarks database and set name to real title
4 This file is a part of Bookmarks database and Internet robot.
7 __author__ = "Oleg Broytman <phd@phdru.name>"
8 __copyright__ = "Copyright (C) 2002-2012 PhiloSoft Design"
9 __license__ = "GNU GPL"
15 from getopt import getopt
16 optlist, args = getopt(sys.argv[1:], "s")
20 for _opt, _arg in optlist:
29 print "Broytman set-real_title, Copyright (C) 2003 PhiloSoft Design"
32 sys.stderr.write("set-real_title: too many arguments\n")
33 sys.stderr.write("Usage: set-real_title [-s]\n")
36 from storage import storage
40 sys.stdout.write("Loading %s: " % storage.filename)
43 root_folder = storage.load()
44 from bkmk_objects import make_linear
45 make_linear(root_folder)
46 objects = len(root_folder.linear)
53 for object_no in range(objects):
54 object = root_folder.linear[object_no]
57 if not hasattr(object, "real_title"):
60 real_title = object.real_title
62 real_title = object.href
63 if object.name <> real_title:
64 object.name = real_title
68 if changed and report_stats:
69 sys.stdout.write("Saving %s: " % storage.filename)
72 if not changed and report_stats:
73 sys.stdout.write("No need to save data\n")
77 storage.store(root_folder)
79 if changed and report_stats:
81 print objects, "objects passed"
82 print changed, "objects changed"
85 if __name__ == '__main__':