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 changed_since_last_sync(local_dir, notebook_name): sync_time = last_sync_time(local_dir, notebook_name) files = utils.filter_files(local_dir, supported_file_exts) modified_time = max(os.path.getmtime(f) for f in files) return modified_time > sync_time