]> git.phdru.name Git - bookmarks_db.git/blobdiff - Storage/bkmk_stjson.py
Store icon's URIs.
[bookmarks_db.git] / Storage / bkmk_stjson.py
index 00daa60361710e5c330cb51b62bc952c279bc757..d44e1114a15a9705b794f6b78413e5800c1b08f9 100644 (file)
@@ -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')}]