diff options
author | Sayamindu Dasgupta <sayamindu@gmail.com> | 2009-08-05 18:00:28 (GMT) |
---|---|---|
committer | Sayamindu Dasgupta <sayamindu@gmail.com> | 2009-08-05 18:00:28 (GMT) |
commit | 9dc4ad107a90811ae3b000f9d84536604d865893 (patch) | |
tree | 06743a4b1f5ea021f3b6f0e006148464d0491bba /readbookmark.py | |
parent | 98e358b9f712aa02a86e076387e6e567fb48167a (diff) |
Add method to Bookmark class to retrieve note title and body
Diffstat (limited to 'readbookmark.py')
-rw-r--r-- | readbookmark.py | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/readbookmark.py b/readbookmark.py index e4a410e..5ac9b24 100644 --- a/readbookmark.py +++ b/readbookmark.py @@ -15,11 +15,13 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +import cjson + class Bookmark: def __init__(self, data): self.md5 = data[0] self.page_no = data[1] - self.title = data[2] + self.content = data[2] self.timestamp = data[3] self.nick = data[4] self.color = data[5] @@ -29,4 +31,20 @@ class Bookmark: return self.page_no == page_no def is_local(self): - return bool(self.local)
\ No newline at end of file + return bool(self.local) + + def get_note_title(self): + if self.content == '' or self.content is None: + return '' + + note = cjson.decode(self.content) + return note['title'] + + def get_note_body(self): + if self.content == '' or self.content is None: + return '' + + note = cjson.decode(self.content) + return note['body'] + + |