]> git.phdru.name Git - bookmarks_db.git/commitdiff
Store LAST_MODIFIED in folder's attributes.
authorOleg Broytman <phd@phdru.name>
Mon, 10 Sep 2007 14:05:49 +0000 (14:05 +0000)
committerOleg Broytman <phd@phdru.name>
Mon, 10 Sep 2007 14:05:49 +0000 (14:05 +0000)
git-svn-id: file:///home/phd/archive/SVN/bookmarks_db/trunk@68 fdd5c36f-1aea-0310-aeeb-c58d7e2b6c23

Storage/bkmk_stflad.py
Writers/bkmk_wflad.py
Writers/bkmk_whtml.py
bkmk_objects.py
bkmk_parser.py
doc/TODO

index 031b03622f2918e1e196518eeb4cc3c2f240ef3f..2545f6d4cdeff4622e28013913b4cce538e161e6 100644 (file)
@@ -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)
index 7619eb32f58e6dbcbec427108fe6b41eb57050e2..2d261586058796e2a3a160b1859731a179036d02 100644 (file)
@@ -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):
index 8b172fc372f39a029a1ad15ea2ff5b85e7276b14..eba924705dc00a72d0bc60f39c1cda9b49455f43 100644 (file)
@@ -34,7 +34,10 @@ class writer_html(Writer):
       self._folder(f, 0)
 
    def start_folder(self, f, level):
-      self.outfile.write(ind_s*level + '<DT><H3 ADD_DATE="%s">%s</H3>\n' % (f.add_date, f.name))
+      self.outfile.write(ind_s*level + '<DT><H3 ADD_DATE="%s"' % f.add_date)
+      if f.last_modified:
+         self.outfile.write(' LAST_MODIFIED="%s"' % f.last_modified)
+      self.outfile.write('>%s</H3>\n' % f.name)
       self._folder(f, level)
 
    def end_folder(self, f, level):
index 231fb2f4e6482b6e2312d928eacc832cc97baf33..fabf0ed5be81b6601ef3801e66d0fb026ccb09df 100644 (file)
@@ -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
index 7ce99e8412447cbba334291783149f80cc2c3e46..02cce680747e054a698f79b4ccd175b8f04b0e96 100755 (executable)
@@ -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
index 0e233c715df16070d87633ac2e30a84a6a55d51f..3d1e7e6a5a57b8e8c704533266317173c76799c2 100644 (file)
--- 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,AAABAAIAEBAQAAAAAAAoAQAAJgAAACAgEAAAAAAA6AIAAE4BAAAoAAAAEAAAACAAAAABAAQAAAAAAMAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAgAAAgAAAAICAAIAAAACAAIAAgIAAAMDAwACAgIAAAAD/AAD/AAAA//8A/wAAAP8A/wD//wAA////AAAAAAAAAAAAAACZAJmZAAAAAAmQCZAAAAAACZAJkAAAAAAJkAmQAAAAAAmQCZAAAAAACZAJkAAAAAAAmZmQAAAAAACZmZAAAAAACZAJkAAAAAAJkAmQAAAAAAmQCZAAAAAACZAJkAAAAAAJkAmQAAAAAACZmZkAAAAAAAAAAAAA//////MP///5n///+Z////mf///5n///+Z////wf///8H///+Z////mf///5n///+Z////mf///8D////////ygAAAAgAAAAQAAAAAEABAAAAAAAgAIAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgACAgAAAwMDAAICAgAAAAP8AAP8AAAD//wD/AAAA/wD/AP//AAD///8AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAmZkAAJmZmZkAAAAAAAAAAJmZkACZmZmZAAAAAAAAAAAAmZkAAJmZAAAAAAAAAAAAAJmZAACZmQAAAAAAAAAAAACZmQAAmZkAAAAAAAAAAAAAmZkAAJmZAAAAAAAAAAAAAJmZAACZmQAAAAAAAAAAAACZmQAAmZkAAAAAAAAAAAAAmZkAAJmZAAAAAAAAAAAAAJmZAACZmQAAAAAAAAAAAACZmQAAmZkAAAAAAAAAAAAACZmQAJmZAAAAAAAAAAAAAAmZmZmZmQAAAAAAAAAAAAAAmZmZmZkAAAAAAAAAAAAAAJmZmZmZAAAAAAAAAAAAAAmZmZmZmQAAAAAAAAAAAAAJmZAAmZkAAAAAAAAAAAAAmZkAAJmZAAAAAAAAAAAAAJmZAACZmQAAAAAAAAAAAACZmQAAmZkAAAAAAAAAAAAAmZkAAJmZAAAAAAAAAAAAAJmZAACZmQAAAAAAAAAAAACZmQAAmZkAAAAAAAAAAAAAmZkAAJmZAAAAAAAAAAAAAJmZAACZmQAAAAAAAAAAAAAJmZAAmZkAAAAAAAAAAAAACZmZmZmZmQAAAAAAAAAAAACZmZmZmZkAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD///////////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"