Show json tags as per FF bookmark convention

This commit is contained in:
Arun Prakash Jana 2016-05-23 09:09:58 +05:30
parent a769f71671
commit 4046afb4ea
No known key found for this signature in database
GPG Key ID: C0A712ED95043DCB

14
buku
View File

@ -943,25 +943,25 @@ def format_json(resultset, single=False):
marks = [] marks = []
for row in resultset: for row in resultset:
if showOpt == 1: if showOpt == 1:
record = { 'url': row[1] } record = { 'uri': row[1] }
elif showOpt == 2: elif showOpt == 2:
record = { 'url': row[1], 'tags': row[3][1:-1] } record = { 'uri': row[1], 'tags': row[3][1:-1] }
else: else:
record = { 'url': row[1], 'title': row[2], 'comment': row[4], 'tags': row[3][1:-1]} record = { 'uri': row[1], 'title': row[2], 'description': row[4], 'tags': row[3][1:-1]}
marks.append(record) marks.append(record)
else: else:
marks = {} marks = {}
for row in resultset: for row in resultset:
if showOpt == 1: if showOpt == 1:
marks['url'] = row[1] marks['uri'] = row[1]
elif showOpt == 2: elif showOpt == 2:
marks['title'] = row[2] marks['uri'] = row[1]
marks['tags'] = row[3][1:-1] marks['tags'] = row[3][1:-1]
else: else:
marks['url'] = row[1] marks['uri'] = row[1]
marks['title'] = row[2] marks['title'] = row[2]
marks['comment'] = row[4] marks['description'] = row[4]
marks['tags'] = row[3][1:-1] marks['tags'] = row[3][1:-1]
return json.dumps(marks, sort_keys=True, indent=4) return json.dumps(marks, sort_keys=True, indent=4)