-#! /usr/bin/env python
+#! /usr/bin/env python3
"""Check duplicate URLs in the bookmarks database
This file is a part of Bookmarks database and Internet robot.
__author__ = "Oleg Broytman <phd@phdru.name>"
-__copyright__ = "Copyright (C) 2000-2017 PhiloSoft Design"
+__copyright__ = "Copyright (C) 2000-2023 PhiloSoft Design"
__license__ = "GNU GPL"
log_file = None
+
def report_dup(href, object_no):
s = "Duplicate URL: %s (first at rec. %d)" % (href, object_no)
pass
if report_stats:
- print("Broytman check_dups, Copyright (C) 2000-2017 PhiloSoft Design")
+ print("Broytman check_dups, Copyright (C) 2000-2023 PhiloSoft Design")
if args:
sys.stderr.write("check_urls: too many arguments\n")
sys.exit(1)
if log_filename:
- log_file = open(log_filename, 'w')
+ log_file = open(log_filename, 'wt')
from storage import storage
storage = storage()
if report_stats:
print("Ok")
-
dup_dict = {}
for object_no in range(objects):
if object.isBookmark:
href = object.href
- if dup_dict.has_key(href):
+ if href in dup_dict:
report_dup(href, dup_dict[href])
else:
dup_dict[href] = object_no
-
if log_filename:
log_file.close()