-"""
- Dump bookmarks db to a more readable FLAD after check_urls
+"""Dump bookmarks db to a more readable FLat Ascii Database
- Written by BroytMann, Apr 2000 - Jun 2002. Copyright (C) 2000-2002 PhiloSoft Design
+This file is a part of Bookmarks database and Internet robot.
"""
+__version__ = "$Revision$"[11:-2]
+__revision__ = "$Id$"[5:-2]
+__date__ = "$Date$"[7:-2]
+__author__ = "Oleg Broytman <phd@phdru.name>"
+__copyright__ = "Copyright (C) 2000-2011 PhiloSoft Design"
+__license__ = "GNU GPL"
+
+__all__ = ['writer_flad']
+
import time
from bkmk_objects import Writer
def strftime(s):
try:
return time.strftime("%a %d %b %Y %T", time.localtime(int(s)))
- except ValueError: # s is already formatted
+ except (TypeError, ValueError): # s is None or is already formatted
return s
Writer.__init__(self, outfile, prune)
self.first_object = 1
-
def start_folder(self, f, level):
self.outfile.write("""
Level: %d
Folder: %s
AddDate: %s
Comment: %s
-""" % (level, f.name, strftime(f.add_date), f.comment))
-
+LastModified: %s
+""" % (level, f.name, strftime(f.add_date), f.comment, strftime(f.last_modified)))
def bookmark(self, b, level):
self.outfile.write("""
AddDate: %s
LastVisit: %s
LastModified: %s
-Comment: %s""" % (level+1, b.name, b.href, strftime(b.add_date), strftime(b.last_visit), strftime(b.last_modified), b.comment))
+Keyword: %s
+Comment: %s""" % (level+1, b.name, b.href, strftime(b.add_date), strftime(b.last_visit), strftime(b.last_modified), b.keyword, b.comment))
for attr_name, attr_out in (("error", "Error"), ("no_error", "NoError"),
("moved", "Moved"), ("size", "Size"), ("md5", "Md5"),
- ("real_title", "RealTitle"), ("test_time", "TestTime")):
+ ("real_title", "RealTitle"), ("test_time", "TestTime"),
+ ("icon_href", "IconURI"), ("icon", "Icon"), ("charset", "Charset")):
if hasattr(b, attr_name):
self.outfile.write("\n%s: %s" % (attr_out, getattr(b, attr_name)))