]> git.phdru.name Git - bookmarks_db.git/commitdiff
Store icon and charset in bookmark's attributes.
authorOleg Broytman <phd@phdru.name>
Fri, 21 Sep 2007 14:44:49 +0000 (14:44 +0000)
committerOleg Broytman <phd@phdru.name>
Fri, 21 Sep 2007 14:44:49 +0000 (14:44 +0000)
git-svn-id: file:///home/phd/archive/SVN/bookmarks_db/trunk@69 fdd5c36f-1aea-0310-aeeb-c58d7e2b6c23

Storage/bkmk_stflad.py
Writers/bkmk_wflad.py
Writers/bkmk_whtml.py
bkmk_objects.py
bkmk_parser.py [changed mode: 0755->0644]
doc/TODO

index 2545f6d4cdeff4622e28013913b4cce538e161e6..b257622559ebbb72c60ffded699c82a4bfe092e0 100644 (file)
@@ -2,7 +2,7 @@
    Bookmarks storage module - FLAD (Flat ASCII Database)
       special version for compatibility with old (version 1) bkmk2db
 
-   Written by BroytMann, Feb 2000 - Mar 2005. Copyright (C) 2000-2005 PhiloSoft Design
+   Written by BroytMann, Feb 2000 - Sep 2007. Copyright (C) 2000-2007 PhiloSoft Design
 """
 
 
@@ -45,8 +45,10 @@ LastVisit: %s
 LastModified: %s
 Keyword: %s
 Comment: %s
+Icon: %s
+Charset: %s
 """ % (level+1, b.name, b.href, b.add_date, b.last_visit, b.last_modified,
-         b.keyword, b.comment.replace('\n', "\\n")))
+         b.keyword, b.comment.replace('\n', "\\n"), b.icon or '', b.charset or ''))
 
 
    def ruler(self, r, level):
index 2d261586058796e2a3a160b1859731a179036d02..0ba70751cfa7693c26f5b965f4f2ef4dbfa9d40f 100644 (file)
@@ -1,7 +1,7 @@
 """
    Dump bookmarks db to a more readable FLAD after check_urls
 
-   Written by BroytMann, Apr 2000 - Aug 2004. Copyright (C) 2000-2004 PhiloSoft Design
+   Written by BroytMann, Apr 2000 - Sep 2007. Copyright (C) 2000-2007 PhiloSoft Design
 """
 
 
@@ -47,7 +47,8 @@ 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")):
+            ("real_title", "RealTitle"), ("test_time", "TestTime"),
+            ("icon", "Icon"), ("charset", "Charset")):
          if hasattr(b, attr_name):
             self.outfile.write("\n%s: %s" % (attr_out, getattr(b, attr_name)))
 
index eba924705dc00a72d0bc60f39c1cda9b49455f43..f2986fd4577ffed773740ef2fe5092d287cdfc6d 100644 (file)
@@ -1,7 +1,7 @@
 """
    Convert a bkmk database back to bookmarks.html
 
-   Written by BroytMann. Copyright (C) 2000-2004 PhiloSoft Design
+   Written by BroytMann. Copyright (C) 2000-2007 PhiloSoft Design
 """
 
 
@@ -35,8 +35,7 @@ class writer_html(Writer):
 
    def start_folder(self, f, level):
       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)
+      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)
 
@@ -46,6 +45,8 @@ class writer_html(Writer):
    def bookmark(self, b, level):
       self.outfile.write(ind_s*(level+1) + '<DT><A HREF="%s" ADD_DATE="%s" LAST_VISIT="%s" LAST_MODIFIED="%s"' % (b.href, b.add_date, b.last_visit, b.last_modified))
       if b.keyword: self.outfile.write(' SHORTCUTURL="%s"' % b.keyword)
+      if b.icon: self.outfile.write(' ICON="%s"' % b.icon)
+      if b.charset: self.outfile.write(' LAST_CHARSET="%s"' % b.charset)
       self.outfile.write('>%s</A>\n' % b.name)
       if b.comment: self.outfile.write('<DD>%s\n' % dump_comment(b.comment))
 
index fabf0ed5be81b6601ef3801e66d0fb026ccb09df..88abdf5f9e6dd76a08e246a3b48eec83b09de374 100644 (file)
@@ -11,7 +11,7 @@ class Folder(UserList):
    isFolder = 1
    isBookmark = 0
 
-   def __init__(self, add_date = None, comment = '', last_modified=None):
+   def __init__(self, add_date=None, comment='', last_modified=None):
       UserList.__init__(self)
       self.comment = comment
       self.add_date = add_date
@@ -43,13 +43,15 @@ class Bookmark:
    isBookmark = 1
 
    def __init__(self, href, add_date, last_visit=None, last_modified=None,
-         keyword=None, comment = ''):
-      self.comment = comment
+         keyword=None, comment='', icon=None, charset=None):
       self.href = href
       self.add_date = add_date
       self.last_visit = last_visit
       self.last_modified = last_modified
       self.keyword = keyword
+      self.comment = comment
+      self.icon = icon
+      self.charset = charset
 
 
 class Ruler:
old mode 100755 (executable)
new mode 100644 (file)
index 02cce68..41df9ef
@@ -138,6 +138,8 @@ class BkmkParser(HTMLParser):
       last_visit = None
       last_modified = None
       keyword = None
+      icon = None
+      charset = None
 
       for attrname, value in attrs:
          value = value.strip()
@@ -151,9 +153,14 @@ class BkmkParser(HTMLParser):
             last_modified = value
          elif attrname == "shortcuturl":
             keyword = value
+         elif attrname == "icon":
+            icon = value
+         elif attrname == "last_charset":
+            charset = value
 
       debug("Bookmark points to: `%s'" % href)
-      bookmark = Bookmark(href, add_date, last_visit, last_modified, keyword or '')
+      bookmark = Bookmark(href, add_date, last_visit, last_modified,
+         keyword or '', '', icon, charset)
       self.current_object = bookmark
       self.current_folder.append(bookmark)
       self.urls += 1
index 3d1e7e6a5a57b8e8c704533266317173c76799c2..c041a66b48b33e5f98dc9e027363a1bdc0f21c18 100644 (file)
--- a/doc/TODO
+++ b/doc/TODO
@@ -1,4 +1,4 @@
-Store icon, charset in bookmark's attributes.
+Store icon and charset in bookmark's attributes.
 ICON="data:image/x-icon;base64,AAABAAIAEBAQAAAAAAAoAQAAJgAAACAgEAAAAAAA6AIAAE4BAAAoAAAAEAAAACAAAAABAAQAAAAAAMAAAAAAAAAAAAAAABAAAAAAAAAAAAAAAAAAgAAAgAAAAICAAIAAAACAAIAAgIAAAMDAwACAgIAAAAD/AAD/AAAA//8A/wAAAP8A/wD//wAA////AAAAAAAAAAAAAACZAJmZAAAAAAmQCZAAAAAACZ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+HD///gA///8AP///AD///gA///4cP//8PD///Dw///w8P//8PD///Dw///w8P//8PD///Dw///4cP//+AA///wAP///////////w=="
 LAST_CHARSET="windows-1251"