]> git.phdru.name Git - bookmarks_db.git/commitdiff
Make annos for SmartBookmarks.
authorOleg Broytman <phd@phdru.name>
Wed, 4 Aug 2010 17:20:46 +0000 (17:20 +0000)
committerOleg Broytman <phd@phdru.name>
Wed, 4 Aug 2010 17:20:46 +0000 (17:20 +0000)
git-svn-id: file:///home/phd/archive/SVN/bookmarks_db/trunk@238 fdd5c36f-1aea-0310-aeeb-c58d7e2b6c23

Storage/bkmk_stjson.py

index 00daa60361710e5c330cb51b62bc952c279bc757..1194aed0743167fc796724fbab3784d001fb7f29 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):
@@ -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')}]