From: Oleg Broytman Date: Wed, 4 Aug 2010 17:20:46 +0000 (+0000) Subject: Make annos for SmartBookmarks. X-Git-Tag: v4.5.3~138 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=3de6c8f6da84fdc757f3b4a3355ed502c4a75318;p=bookmarks_db.git Make annos for SmartBookmarks. git-svn-id: file:///home/phd/archive/SVN/bookmarks_db/trunk@238 fdd5c36f-1aea-0310-aeeb-c58d7e2b6c23 --- diff --git a/Storage/bkmk_stjson.py b/Storage/bkmk_stjson.py index 00daa60..1194aed 100644 --- a/Storage/bkmk_stjson.py +++ b/Storage/bkmk_stjson.py @@ -65,7 +65,17 @@ class storage_json(Walker): dict["parent"] = b.parent_idx dict["title"] = b.name.decode('utf-8') dict["type"] = "text/x-moz-place" - dict["uri"] = b.href + dict["uri"] = uri = b.href + if uri.startswith('place:'): + if uri.startswith('place:sort=8'): + value = 'MostVisited' + elif uri.startswith('place:folder=BOOKMARKS_MENU'): + value = 'RecentlyBookmarked' + elif uri.startswith('place:sort=14'): + value = 'RecentTags' + dict["annos"] = make_annos(value, name='Places/SmartBookmark') + del dict["dateAdded"] + del dict["lastModified"] self.folder_stack[-1].append(dict) def ruler(self, r, level): @@ -182,11 +192,11 @@ def get_comment(annos): return None -def make_annos(comment): +def make_annos(value, name="bookmarkProperties/description"): return [{ "expires": 4, "flags": 0, "mimeType": None, - "name": "bookmarkProperties/description", + "name": name, "type": 3, - "value": comment.decode('utf-8')}] + "value": value.decode('utf-8')}]