From 3de6c8f6da84fdc757f3b4a3355ed502c4a75318 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Wed, 4 Aug 2010 17:20:46 +0000 Subject: [PATCH] Make annos for SmartBookmarks. git-svn-id: file:///home/phd/archive/SVN/bookmarks_db/trunk@238 fdd5c36f-1aea-0310-aeeb-c58d7e2b6c23 --- Storage/bkmk_stjson.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) 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')}] -- 2.39.2