Fix for new standard notes archives using zip files. #9
@@ -1,11 +1,9 @@
|
||||
# Attention: It has been reported that the following methodology is no longer valid as it exports Starndard Notes in a new format. A pull request is needed to fix it.
|
||||
|
||||
## Usage:
|
||||
|
||||
```bash
|
||||
python3 standard-notes-to-enex.py SN_Archive.txt
|
||||
python3 standard-notes-to-enex.py SN_Archive.zip
|
||||
```
|
||||
If a name like `SN_Archive.txt` is not provided, the script will assume your file is called `notes.txt`.
|
||||
If a name like `SN_Archive.zip` is not provided, the script will assume your file is called `notes.zip`.
|
||||
|
||||
## Tutorial
|
||||
|
||||
|
||||
@@ -3,11 +3,12 @@ import html
|
||||
import datetime
|
||||
import re
|
||||
from sys import argv
|
||||
import zipfile
|
||||
|
||||
source = argv[1] if len(argv) > 1 else 'notes.txt'
|
||||
|
||||
data = json.load(open(source))
|
||||
source = argv[1] if len(argv) > 1 else 'notes.zip'
|
||||
|
||||
with zipfile.ZipFile(source, 'r') as zip_ref:
|
||||
data = json.loads(zip_ref.read('Standard Notes Backup and Import File txt.txt').decode('utf-8'))
|
||||
|
||||
def text_from_html(title, text):
|
||||
# Clear title
|
||||
@@ -65,6 +66,6 @@ final_file += '''</en-export>''' # close root tag
|
||||
|
||||
|
||||
# Save
|
||||
with open("notes.enex", "w") as text_file:
|
||||
with open("notes.enex", "w", encoding='utf-8') as text_file:
|
||||
text_file.write(final_file)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user