]> git.phdru.name Git - bookmarks_db.git/blobdiff - set-real_title.py
Remove robots based on Twisted
[bookmarks_db.git] / set-real_title.py
index a97a421ce84fcf44b20d93d089f14da19f2c59d6..3705ee9f00fc82c673f4768dcd98b33c85044510 100755 (executable)
@@ -1,4 +1,4 @@
-#! /usr/bin/env python
+#! /usr/bin/env python3
 """Run through the bookmarks database and set name to real title
 
 This file is a part of Bookmarks database and Internet robot.
@@ -9,7 +9,7 @@ import sys
 
 
 __author__ = "Oleg Broytman <phd@phdru.name>"
-__copyright__ = "Copyright (C) 2002-2017 PhiloSoft Design"
+__copyright__ = "Copyright (C) 2002-2024 PhiloSoft Design"
 __license__ = "GNU GPL"
 
 
@@ -28,8 +28,8 @@ def run():
         pass
 
     if report_stats:
-        print("Broytman set-real_title, Copyright (C) 2003-2017 PhiloSoft Design")
-
+        print("Broytman set-real_title, Copyright (C)"
+              " 2003-2024 PhiloSoft Design")
     if args:
         sys.stderr.write("set-real_title: too many arguments\n")
         sys.stderr.write("Usage: set-real_title [-s]\n")
@@ -43,14 +43,13 @@ def run():
         sys.stdout.flush()
 
     root_folder = storage.load()
-    from bkmk_objects import make_linear
+    from bkmk_objects import make_linear, break_tree
     make_linear(root_folder)
     objects = len(root_folder.linear)
 
     if report_stats:
         print("Ok")
 
-
     changed = 0
     for object_no in range(objects):
         object = root_folder.linear[object_no]
@@ -66,7 +65,6 @@ def run():
                 object.name = real_title
                 changed += 1
 
-
     if changed and report_stats:
         sys.stdout.write("Saving %s: " % storage.filename)
         sys.stdout.flush()
@@ -76,6 +74,8 @@ def run():
         sys.stdout.flush()
 
     if changed:
+        break_tree(root_folder.linear)
+        del root_folder.linear
         storage.store(root_folder)
 
     if changed and report_stats: