X-Git-Url: https://git.phdru.name/?a=blobdiff_plain;f=Storage%2Fbkmk_stjson.py;h=d44e1114a15a9705b794f6b78413e5800c1b08f9;hb=ffc8cd83bb4bc59f4b447da0e16dc9323bac6ccf;hp=00daa60361710e5c330cb51b62bc952c279bc757;hpb=b3939ade7f545a07b93188543761ada36e996d11;p=bookmarks_db.git diff --git a/Storage/bkmk_stjson.py b/Storage/bkmk_stjson.py index 00daa60..d44e111 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): @@ -173,20 +183,20 @@ def encode(title): def get_comment(annos): if not annos: - return None + return '' for a in annos: if a["name"] == "bookmarkProperties/description" and \ a["type"] == 3: return a["value"].encode('utf-8') - return None + return '' -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')}]