def update_note(store, note, path): """Update a note from the content in a local file """ ext = utils.get_file_ext(path) processor_cls = note_processors.get(ext) processor = processor_cls(path) note.title = processor.get_title() note.content = processor.get_content() note.updated = os.path.getmtime(path) * 1000 try: store.updateNote(dev_token, note) except EDAMUserException as e: evernote_api_error(e, note) return note
def create_note(store, path, notebook): """Create a note from the content in a local file """ ext = utils.get_file_ext(path) processor_cls = note_processors.get(ext) processor = processor_cls(path) note = Note() note.title = processor.get_title() note.content = processor.get_content() attributes = NoteAttributes() attributes.sourceURL = utils.path_to_source_url(notebook, path) note.attributes = attributes note.notebookGuid = notebook.guid try: return store.createNote(dev_token, note) except EDAMUserException as e: evernote_api_error(e, note)