From c2317ae43eb25f18610b908421a35e01841c463f Mon Sep 17 00:00:00 2001 From: Daniel Bauer Date: Fri, 29 May 2020 12:31:38 +0200 Subject: [PATCH 1/3] Update README.md --- README.md | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 54 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 3533cc1..292076e 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,65 @@ -Tool to sync files between your zotero library and the remarkable using webdav +Transfer files from a Zotero collection to a folder on a reMarkable. +This uses the Zotero and reMarkable API to keep your reMarkable updated with a folder from Zotero. In short, it fetches a collection from zotero, uses CalDAV to download all corresponding .pdf and .epub files and finally uploads them to the reMarkable cloud. Finally, the zotero collection is cleared to prevent uploading the same file multiple times (so dont use it on your main library but create a separate fodler!) -**Caution**: Right now, all login credentials are stored in clear text in your home +#### Installation & Usage #### + +Install via pip: +``` python +> pip install git+https://github.com/danijoo/sync_zotero_remarkable +``` + +On first run, you will be asked to provide login information to zotero, your associated caldav api and remarkable: +```bash +> sync_zotero_rm + +zot_api_key: ******* +zot_user_id: ******* +zot_collection: unread_files +webdav_url: ******* +webdav_user: ******* +webdav_password: ******* +rm_folder: Read me! +``` + +**Caution**: All login credentials are stored in clear text in your home folder (`~/.zotero_remarkable.yaml`). So you probably do not want to use this on publicly accessible devices. +And then: +```bash +Fetching collection from Zotero... Done. +Fetching item list... Done. +Items to sync: 1 + +#### Processing files #### + +Kunzmann et al_2020_Substitution matrix based color schemes for sequence alignment visualization.pdf download, unzip, upload, done. + +Removing uploaded items from zotero collection...Done. +Sync complete. + + +# let's see if it worked. +> rmapi +ReMarkable Cloud API Shell +[/]>cd Read\ me!/ +[/Read me!]>ls + +[f] Kunzmann et al_2020_Substitution matrix based color schemes for sequence alignment visualization +``` + + + + #### TODO -- Remarkable authorization / connection (right now, rmapi is required to set things up) -- Handle all the corner cases +- Handle some the corner cases +- Option to not clear the folder #### LICENSE ![do whatever you want](https://upload.wikimedia.org/wikipedia/commons/thumb/0/0a/WTFPL_badge.svg/220px-WTFPL_badge.svg.png) -Do whatever you want. \ No newline at end of file +Do whatever you want. + +Inspired by ![Michael Mior's Zotero reMarkable sync (PHP)](https://github.com/michaelmior/zotero-remarkable) From 4895aa4581e98432ae84565e7c790884b108ff40 Mon Sep 17 00:00:00 2001 From: Daniel Bauer Date: Fri, 29 May 2020 12:32:11 +0200 Subject: [PATCH 2/3] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 292076e..2212776 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -Transfer files from a Zotero collection to a folder on a reMarkable. +## Transfer files from a Zotero collection to a folder on a reMarkable. This uses the Zotero and reMarkable API to keep your reMarkable updated with a folder from Zotero. In short, it fetches a collection from zotero, uses CalDAV to download all corresponding .pdf and .epub files and finally uploads them to the reMarkable cloud. Finally, the zotero collection is cleared to prevent uploading the same file multiple times (so dont use it on your main library but create a separate fodler!) From b337ea1afc881814c64ccede44e2254b0bffa7a6 Mon Sep 17 00:00:00 2001 From: Vinay Hiremath Date: Mon, 6 Jul 2020 16:39:23 +0200 Subject: [PATCH 3/3] Bug fixes in sync_zotero_rm L22: `rmapy.renew_token()` must be indented to run before the `rmapy_is_auth()` check, as `is_auth()` verifies that a user token has been generated but this is done by `renew_token()`. L80: Folder name is in `cfg['rm_folder']`, the previous variable did not exist. Bugfix --- bin/sync_zotero_rm | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bin/sync_zotero_rm b/bin/sync_zotero_rm index 5e0836b..1e0cdbe 100644 --- a/bin/sync_zotero_rm +++ b/bin/sync_zotero_rm @@ -19,7 +19,7 @@ def get_rmapy_client(): print("Enter one-time code (from https://my.remarkable.com/connect/desktop):") key = input() rmapy.register_device(key.strip()) - rmapy.renew_token() + rmapy.renew_token() return rmapy if __name__ == "__main__": @@ -77,7 +77,7 @@ if __name__ == "__main__": if len(folder) > 0: folder = folder[0] else: # folder does not exist yet - print(f"Creating folder {remarkable_folder} on RM.") + print(f"Creating folder {cfg['rm_folder']} on RM.") folder = Folder(cfg['rm_folder']) rmapy.create_folder(folder) @@ -119,4 +119,4 @@ if __name__ == "__main__": continue zot.deletefrom_collection(zot_collection_key, item) print("Done.") - print("Sync complete.") \ No newline at end of file + print("Sync complete.")