]> git.phdru.name Git - bookmarks_db.git/blob - Writers/bkmk_wflad_err.py
Version 3.3.1.
[bookmarks_db.git] / Writers / bkmk_wflad_err.py
1 """
2    Dump bookmarks db to a more readable FLAD after check_urls
3
4    Written by BroytMann, Oct 2000 - Jun 2002. Copyright (C) 2000-2002 PhiloSoft Design
5 """
6
7
8 import time
9 from bkmk_objects import Writer
10
11
12 def strftime(s):
13    return time.strftime("%a %d %b %Y %T", time.localtime(int(s)))
14
15
16 class writer_flad_err(Writer):
17    filename = "bookmarks_db.errors"
18
19    def bookmark(self, b, level):
20       if not hasattr(b, "error"):
21          return
22
23       self.outfile.write("""
24 Level: %d
25 Title: %s
26 URL: %s
27 AddDate: %s
28 LastVisit: %s
29 LastModified: %s
30 Comment: %s""" % (1, b.name, b.href, strftime(b.add_date), strftime(b.last_visit), strftime(b.last_modified), b.comment))
31
32       for attr_name, attr_out in (("error", "Error"), ("no_error", "NoError"),
33             ("moved", "Moved"), ("size", "Size"), ("md5", "Md5"),
34             ("real_title", "RealTitle"), ("test_time", "TestTime")):
35          if hasattr(b, attr_name):
36             self.outfile.write("\n%s: %s" % (attr_out, getattr(b, attr_name)))
37
38       if hasattr(b, "last_tested"):
39          self.outfile.write("\n%s: %s" % ("LastTested", strftime(getattr(b, "last_tested"))))
40
41       self.outfile.write("\n")