new_b = pickle.loads(subp_pipe.read_record())
for attr in ("error", "no_error",
"moved", "size", "md5", "real_title",
- "last_tested", "last_modified", "test_time", "icon"):
+ "last_tested", "last_modified", "test_time",
+ "icon", "icon_href"):
if hasattr(new_b, attr):
setattr(bookmark, attr, getattr(new_b, attr))
else:
self.log(" looking for icon at: %s" % icon)
if icon in icons:
if icons[icon]:
+ bookmark.icon_href = icon
content_type, bookmark.icon = icons[icon]
self.log(" cached icon: %s" % content_type)
else:
content_type = headers["Content-Type"]
if content_type.startswith("image/"):
icon_file = open(fname, "rb")
- icon = icon_file.read()
+ icon_data = icon_file.read()
icon_file.close()
- bookmark.icon = "data:%s;base64,%s" % (content_type, b64encode(icon))
+ bookmark.icon_href = icon
+ bookmark.icon = "data:%s;base64,%s" % (content_type, b64encode(icon_data))
self.log(" got icon : %s" % content_type)
icons[icon] = (content_type, bookmark.icon)
else:
Bookmarks storage module - FLAD (Flat ASCII Database)
special version for compatibility with old (version 1) bkmk2db
- Written by Broytman, Feb 2000 - Sep 2007. Copyright (C) 2000-2007 PhiloSoft Design
+ Written by Broytman. Copyright (C) 2000-2010 PhiloSoft Design
"""
LastModified: %s
Keyword: %s
Comment: %s
+IconURI: %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.icon or '', b.charset or ''))
+ b.keyword, b.comment.replace('\n', "\\n"),
+ b.icon_href or '', b.icon or '', b.charset or ''))
def ruler(self, r, level):
"""
Convert a bkmk database back to bookmarks.html
- Written by Broytman. Copyright (C) 2000-2007 PhiloSoft Design
+ Written by Broytman. Copyright (C) 2000-2010 PhiloSoft Design
"""
from bkmk_objects import Writer, BKMK_FORMAT, quote_title
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 BKMK_FORMAT == "MOZILLA":
if b.keyword: self.outfile.write(' SHORTCUTURL="%s"' % b.keyword)
+ if b.icon_href: self.outfile.write(' ICON_URI="%s"' % b.icon_href)
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' % quote_title(b.name))
isBookmark = 1
def __init__(self, href, add_date, last_visit=None, last_modified=None,
- keyword=None, comment='', icon=None, charset=None):
+ keyword=None, comment='', icon_href=None, 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_href = icon_href
self.icon = icon
self.charset = charset
URL: %s
Title: %s
LastModified: %s
+IconURI: %s
Icon: %s
-""" % (bookmark.href, getattr(bookmark, 'real_title', ''), strftime(bookmark.last_modified), bookmark.icon)
+""" % (bookmark.href, getattr(bookmark, 'real_title', ''), strftime(bookmark.last_modified), bookmark.icon_href, bookmark.icon)
robot.stop()
log.close()