From bcf579e3311f0d9f968338dc419e9a43b48414ba Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Mon, 10 Sep 2007 14:05:49 +0000 Subject: [PATCH] Store LAST_MODIFIED in folder's attributes. git-svn-id: file:///home/phd/archive/SVN/bookmarks_db/trunk@68 fdd5c36f-1aea-0310-aeeb-c58d7e2b6c23 --- Storage/bkmk_stflad.py | 6 +++--- Writers/bkmk_wflad.py | 3 ++- Writers/bkmk_whtml.py | 5 ++++- bkmk_objects.py | 6 +++--- bkmk_parser.py | 7 +++++-- doc/TODO | 2 -- 6 files changed, 17 insertions(+), 12 deletions(-) diff --git a/Storage/bkmk_stflad.py b/Storage/bkmk_stflad.py index 031b036..2545f6d 100644 --- a/Storage/bkmk_stflad.py +++ b/Storage/bkmk_stflad.py @@ -32,8 +32,8 @@ Level: %d Folder: %s AddDate: %s Comment: %s -""" % (level, f.name, f.add_date, f.comment)) - +LastModified: %s +""" % (level, f.name, f.add_date, f.comment, f.last_modified or '')) def bookmark(self, b, level): self.outfile.write(""" @@ -113,7 +113,7 @@ Comment: %s self.current_folder.append(bookmark) elif record.has_key("Folder"): - folder = Folder(record["AddDate"], record["Comment"]) + folder = Folder(record["AddDate"], record["Comment"], record["LastModified"]) folder.name = record["Folder"] self.current_folder.append(folder) self.folder_stack.append(folder) diff --git a/Writers/bkmk_wflad.py b/Writers/bkmk_wflad.py index 7619eb3..2d26158 100644 --- a/Writers/bkmk_wflad.py +++ b/Writers/bkmk_wflad.py @@ -30,7 +30,8 @@ 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, f.last_modified or '')) def bookmark(self, b, level): diff --git a/Writers/bkmk_whtml.py b/Writers/bkmk_whtml.py index 8b172fc..eba9247 100644 --- a/Writers/bkmk_whtml.py +++ b/Writers/bkmk_whtml.py @@ -34,7 +34,10 @@ class writer_html(Writer): self._folder(f, 0) def start_folder(self, f, level): - self.outfile.write(ind_s*level + '

%s

\n' % (f.add_date, f.name)) + self.outfile.write(ind_s*level + '

%s

\n' % f.name) self._folder(f, level) def end_folder(self, f, level): diff --git a/bkmk_objects.py b/bkmk_objects.py index 231fb2f..fabf0ed 100644 --- a/bkmk_objects.py +++ b/bkmk_objects.py @@ -1,7 +1,7 @@ """ Objects to represent bookmarks.html structure - Written by BroytMann, Mar 2000 - Aug 2004. Copyright (C) 2000-2004 PhiloSoft Design + Written by BroytMann, Mar 2000 - Sep 2007. Copyright (C) 2000-2007 PhiloSoft Design """ @@ -11,11 +11,11 @@ class Folder(UserList): isFolder = 1 isBookmark = 0 - def __init__(self, add_date = None, comment = ''): + def __init__(self, add_date = None, comment = '', last_modified=None): UserList.__init__(self) self.comment = comment self.add_date = add_date - + self.last_modified = last_modified def walk_depth(self, walker, level=0): if hasattr(self, "header"): # root folder diff --git a/bkmk_parser.py b/bkmk_parser.py index 7ce99e8..02cce68 100755 --- a/bkmk_parser.py +++ b/bkmk_parser.py @@ -1,7 +1,7 @@ """ Parser for Netscape Navigator's and Mozilla's bookmarks.html - Written by BroytMann. Copyright (C) 1997-2005 PhiloSoft Design + Written by BroytMann. Copyright (C) 1997-2007 PhiloSoft Design """ @@ -109,13 +109,16 @@ class BkmkParser(HTMLParser): # Start a folder def start_h3(self, attrs): + last_modified = None for attrname, value in attrs: value = value.strip() if attrname == 'add_date': add_date = value + elif attrname == 'last_modified': + last_modified = value debug("New folder...") - folder = Folder(add_date) + folder = Folder(add_date, last_modified=last_modified) self.current_object = folder self.current_folder.append(folder) self.folder_stack.append(folder) # push new folder diff --git a/doc/TODO b/doc/TODO index 0e233c7..3d1e7e6 100644 --- a/doc/TODO +++ b/doc/TODO @@ -1,5 +1,3 @@ -Store LAST_MODIFIED in folder's attributes. - Store icon, charset in bookmark's attributes. ICON="data:image/x-icon;base64,AAABAAIAEBAQAAAAAAAoAQAAJgAAACAgEAAAAAAA6AIAAE4BAAAoAAAAEAAAACAAAAABAAQAAAAA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kAAAAAAAAAAAAACZmZmZmZmQAAAAAAAAAAAACZmZmZmZkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////8PAP//BwD//8PD///Dw///w8P//8PD///Dw///w8P//8PD///Dw///w8P//+HD///gA///8AP///AD///gA///4cP//8PD///Dw///w8P//8PD///Dw///w8P//8PD///Dw///4cP//+AA///wAP///////////w==" LAST_CHARSET="windows-1251" -- 2.39.5