Added readme
This commit is contained in:
@@ -177,18 +177,14 @@ def export_to_onenote(simplenotes, onenote_mgr, chosen_notebook=None, chosen_sec
|
|||||||
print("Section not found for '%s'" % (chosen_section))
|
print("Section not found for '%s'" % (chosen_section))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
config = onenote_mgr.config
|
||||||
|
|
||||||
onenote_section = retrieve_section(onenote_sections, chosen_section)
|
onenote_section = retrieve_section(onenote_sections, chosen_section)
|
||||||
url="https://graph.microsoft.com/v1.0/me/onenote/sections/" + onenote_section["id"] + "/pages"
|
url = f"{config.base_url}me/onenote/sections/" + onenote_section["id"] + "/pages"
|
||||||
onenote_notes = onenote_mgr.get_notes(url)
|
onenote_notes = onenote_mgr.get_notes(url)
|
||||||
|
|
||||||
count = 0
|
count = 0
|
||||||
|
|
||||||
config = onenote_mgr.config
|
|
||||||
interval = config.interval
|
|
||||||
limit = config.limit
|
|
||||||
total_notes_added = 0
|
|
||||||
bundle_notes_added = 0
|
|
||||||
|
|
||||||
for note in onenote_notes["value"]:
|
for note in onenote_notes["value"]:
|
||||||
count += 1
|
count += 1
|
||||||
|
|
||||||
@@ -196,6 +192,11 @@ def export_to_onenote(simplenotes, onenote_mgr, chosen_notebook=None, chosen_sec
|
|||||||
print("Note not foudn for '%s'" % (chosen_section))
|
print("Note not foudn for '%s'" % (chosen_section))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
interval = config.interval
|
||||||
|
limit = config.limit
|
||||||
|
total_notes_added = 0
|
||||||
|
bundle_notes_added = 0
|
||||||
|
|
||||||
for note in simplenotes:
|
for note in simplenotes:
|
||||||
if note_exists_in_onenote(note, onenote_notes):
|
if note_exists_in_onenote(note, onenote_notes):
|
||||||
continue
|
continue
|
||||||
@@ -218,6 +219,7 @@ def export_to_onenote(simplenotes, onenote_mgr, chosen_notebook=None, chosen_sec
|
|||||||
|
|
||||||
config = load_config()
|
config = load_config()
|
||||||
onenote_mgr.config = config
|
onenote_mgr.config = config
|
||||||
|
onenote_notes = onenote_mgr.get_notes(url)
|
||||||
|
|
||||||
bundle_notes_added = 0
|
bundle_notes_added = 0
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -0,0 +1,60 @@
|
|||||||
|
# s2o
|
||||||
|
|
||||||
|
s2o is a software utility tool to export notes from Simplenote to OneNote. This software exports notes from Simplenote and creates notes in a specific notebook and section. Once the note has been created, the note is deleted from Simplenote.
|
||||||
|
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
```JSON
|
||||||
|
{
|
||||||
|
"token": "some_token",
|
||||||
|
"secret": "some secret",
|
||||||
|
"app_id": "sdf348thg348fh3f",
|
||||||
|
"mode": "token",
|
||||||
|
"scopes": ["Create", "Read"],
|
||||||
|
"authority_url": "https://some-link.com",
|
||||||
|
"base_url": "https://some-other-link.com",
|
||||||
|
"limit": 100,
|
||||||
|
"interval": 300,
|
||||||
|
"vendors": {
|
||||||
|
"simplenote": {
|
||||||
|
"username": "me",
|
||||||
|
"password": "who",
|
||||||
|
"source_notebook": "",
|
||||||
|
"source_section": ""
|
||||||
|
},
|
||||||
|
"onenote": {
|
||||||
|
"username": "",
|
||||||
|
"password": "",
|
||||||
|
"target_notebook": "New notebook",
|
||||||
|
"target_section": "New Section"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
* `token` - Access token used for making OneNote requests. This token will be used if the `mode` is token
|
||||||
|
* `secret` - The secret phrase when creating the App from Microsoft dev platform
|
||||||
|
* `app_id` - The application ID when creating the App from Microsoft dev platform
|
||||||
|
* `mode` - Mode that determines how a token will be retrieved. Supported modes are *token input* and *token*. *token input* will require you to provide the token via the shell. *token* will use the value specified in the `token` field
|
||||||
|
* `scopes` - Requested scope actions
|
||||||
|
* `authority_url` - URL for authorization
|
||||||
|
* `base_url` - Base URL for Microsoft Graph API
|
||||||
|
* `limit` - The limit in which notes can be exported before sleeping. This is used to prevent too many requests in a short period of time which results in a denial of service
|
||||||
|
* `interval` - Time in seconds to sleep after a certain amount of notes have been exported. The amount is specified by the `limit` field
|
||||||
|
* `vendors` - Suported vendors
|
||||||
|
* `simplenote:username` - Username of the Simplenote account
|
||||||
|
* `simplenote:password` - Password of the Simplenote account
|
||||||
|
* `simplenote:source_notebook` - Not used
|
||||||
|
* `simplenote:source_section` - Not used
|
||||||
|
* `onenote:username` - Not used
|
||||||
|
* `onenote:password` - Not used
|
||||||
|
* `onenote:target_notebook` - Target notebook to save notes from Simplenote
|
||||||
|
* `onenote:target_section` -- Target section to save notes from Simplenote
|
||||||
|
|
||||||
|
|
||||||
|
## Usages
|
||||||
|
|
||||||
|
```BASH
|
||||||
|
python main.py [path to config.json]
|
||||||
|
```
|
||||||
Reference in New Issue
Block a user