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 __version__ = "$Revision$"[11:-2]
8 __revision__ = "$Id$"[5:-2]
9 __date__ = "$Date$"[7:-2]
10 __author__ = "Oleg Broytman <phd@phdru.name>"
11 __copyright__ = "Copyright (C) 2002-2011 PhiloSoft Design"
12 __license__ = "GNU GPL"
18 from getopt import getopt
19 optlist, args = getopt(sys.argv[1:], "s")
23 for _opt, _arg in optlist:
32 print "Broytman set-real_title, Copyright (C) 2003 PhiloSoft Design"
35 sys.stderr.write("set-real_title: too many arguments\n")
36 sys.stderr.write("Usage: set-real_title [-s]\n")
39 from storage import storage
43 sys.stdout.write("Loading %s: " % storage.filename)
46 root_folder = storage.load()
47 from bkmk_objects import make_linear
48 make_linear(root_folder)
49 objects = len(root_folder.linear)
56 for object_no in range(objects):
57 object = root_folder.linear[object_no]
60 if not hasattr(object, "real_title"):
63 real_title = object.real_title
65 real_title = object.href
66 if object.name <> real_title:
67 object.name = real_title
71 if changed and report_stats:
72 sys.stdout.write("Saving %s: " % storage.filename)
75 if not changed and report_stats:
76 sys.stdout.write("No need to save data\n")
80 storage.store(root_folder)
82 if changed and report_stats:
84 print objects, "objects passed"
85 print changed, "objects changed"
88 if __name__ == '__main__':