def sync(local_dir, notebook_name): if not os.path.exists(local_dir): error("{} doesn't exist".format(local_dir)) with utils.chdir(local_dir): client = EvernoteClient(service_host=service_host, token=dev_token) store = client.get_note_store() notebook = tset_notebook(store, notebook_name) files = utils.filter_files('.', supported_file_exts) log('Found {} note files under {}'.format(len(files), os.getcwd())) result = upsert_notes(store, files, notebook) log('''Sync completed. Created:{created} Updated:{updated} Removed:{removed}'''.format(**result))
def sync(local_dir, notebook_name): if not os.path.exists(local_dir): error("{} doesn't exist".format(local_dir)) with utils.chdir(local_dir): client = EvernoteClient(service_host=service_host, token=dev_token) store = client.get_note_store() notebook = tset_notebook(store, notebook_name) files = utils.filter_files('.', supported_file_exts) log('Found {} note files under {}'.format( len(files), os.getcwd())) result = upsert_notes(store, files, notebook) log('''Sync completed. Created:{created} Updated:{updated} Removed:{removed}'''.format(**result))
def evernote_api_error(e, note): error(e) if e.errorCode == EDAMErrorCode.ENML_VALIDATION: error("Invalid note content:") error(note.content) sys.exit(1)