Browse Source

Update the script for older versions of Scarlet

master
Timur Demin 1 month ago
parent
commit
35f0b7326f
Signed by: Timur Demin <me@tdem.in> GPG Key ID: 9EDF3F9D9286FA20
2 changed files with 9 additions and 6 deletions
  1. 4
    2
      scarlet_export/__init__.py
  2. 5
    4
      scarlet_export/note.py

+ 4
- 2
scarlet_export/__init__.py View File

@@ -62,8 +62,10 @@ def main():
for tag in data['tags']:
tags[tag['uuid']] = tag['title']
folders = {}
for folder in data['folders']:
folders[folder['uuid']] = folder['title']
# folders are only available in Scarlet v6 and later
if 'folders' in data:
for folder in data['folders']:
folders[folder['uuid']] = folder['title']
for note in data['notes']:
parsedNote = Note(note, tags, folders)
notes.append(parsedNote)

+ 5
- 4
scarlet_export/note.py View File

@@ -13,10 +13,11 @@ class Note:
"""
def __init__(self, note, tags, folders):
self.uuid = note['uuid']
if note['folder'] != '':
self.folder = folders[note['folder']]
else:
self.folder = ''
# folders are only available since Scarlet v6
if 'folder' in note:
if note['folder'] != '':
self.folder = folders[note['folder']]
else: self.folder = ''
self.updateTimestamp = int(note['updateTimestamp'])
self.timestamp = int(note['timestamp'])
self.tags = []

Loading…
Cancel
Save