X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=Writers%2Fbkmk_wflad.py;h=a82c52ca586244e7024bc18ede089afb775d5ab8;hb=3fa95e7ba73b268164c50290b394e57fcf790cf0;hp=c324194a125f38c030a924ebd0c9d34bd13a655c;hpb=0e76f1851882b99da63a7c8a9e4cdf0c4a48657f;p=bookmarks_db.git diff --git a/Writers/bkmk_wflad.py b/Writers/bkmk_wflad.py index c324194..a82c52c 100644 --- a/Writers/bkmk_wflad.py +++ b/Writers/bkmk_wflad.py @@ -1,17 +1,30 @@ -""" - Dump bookmarks db to a more readable FLAD after check_urls +"""Dump bookmarks db to a more readable FLat Ascii Database - Written by Broytman. Copyright (C) 2000-2007 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 " +__copyright__ = "Copyright (C) 2000-2011 PhiloSoft Design" +__license__ = "GNU GPL" + +__all__ = ['writer_flad'] + import time from bkmk_objects import Writer def strftime(s): + if s is None: + return s + n = int(s) + if n > 10**10: + n /= 10**6 try: - return time.strftime("%a %d %b %Y %T", time.localtime(int(s))) + return time.strftime("%a %d %b %Y %T", time.localtime(n)) except (TypeError, ValueError): # s is None or is already formatted return s @@ -23,7 +36,6 @@ class writer_flad(Writer): Writer.__init__(self, outfile, prune) self.first_object = 1 - def start_folder(self, f, level): self.outfile.write(""" Level: %d @@ -31,8 +43,7 @@ Folder: %s AddDate: %s Comment: %s LastModified: %s -""" % (level, f.name, strftime(f.add_date), f.comment, f.last_modified or '')) - +""" % (level, f.name, strftime(f.add_date), f.comment, strftime(f.last_modified))) def bookmark(self, b, level): self.outfile.write(""" @@ -48,7 +59,7 @@ Comment: %s""" % (level+1, b.name, b.href, strftime(b.add_date), strftime(b.last for attr_name, attr_out in (("error", "Error"), ("no_error", "NoError"), ("moved", "Moved"), ("size", "Size"), ("md5", "Md5"), ("real_title", "RealTitle"), ("test_time", "TestTime"), - ("icon", "Icon"), ("charset", "Charset")): + ("icon_href", "IconURI"), ("icon", "Icon"), ("charset", "Charset")): if hasattr(b, attr_name): self.outfile.write("\n%s: %s" % (attr_out, getattr(b, attr_name)))