From 82a2095492b09e2405061c5f1738c317222a4a0a Mon Sep 17 00:00:00 2001 From: Stijn Van Campenhout Date: Wed, 27 Nov 2019 13:38:07 +0100 Subject: [PATCH] Update Documentation --- docs/source/index.rst | 6 ++-- docs/source/modules.rst | 4 +-- docs/source/quickstart.rst | 62 +++++++++++++++++++++++++++++++++++++- 3 files changed, 66 insertions(+), 6 deletions(-) diff --git a/docs/source/index.rst b/docs/source/index.rst index 7ebc1ed..e3f63e4 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -18,9 +18,9 @@ API Support | ☑️ Work with documents & folders | ☑️ create a folder | ☑️ move / rename a document or folder -| ❎ create a document -| ❎ edit a document -| ❎ delete a document or folder +| ☑️ create a document +| ☑️ edit a document +| ☑️ delete a document or folder | ❎ cli interface | ❎ export pdf with annotations diff --git a/docs/source/modules.rst b/docs/source/modules.rst index 079745c..12d31a6 100644 --- a/docs/source/modules.rst +++ b/docs/source/modules.rst @@ -1,5 +1,5 @@ -rmapipy -======= +rmapi +===== .. toctree:: :maxdepth: 4 diff --git a/docs/source/quickstart.rst b/docs/source/quickstart.rst index 20e0f65..2911577 100644 --- a/docs/source/quickstart.rst +++ b/docs/source/quickstart.rst @@ -112,7 +112,6 @@ Changing the metadata is easy CollectionType `````````````` - A CollectionType is a Folder. These types are represented by the object :class:`rmapi.folder.Folder` @@ -162,3 +161,64 @@ Working with folders is easy! >>> doc.Parent == new_folder.ID True + +Uploading & downloading +~~~~~~~~~~~~~~~~~~~~~~~~ + +reMarkable has a "special" file format for the raw documents. +This is basically a zip file with files describing the document. + +Here is the content of an archive retried on the tablet as example: + + * 384327f5-133e-49c8-82ff-30aa19f3cfa40.content + * 384327f5-133e-49c8-82ff-30aa19f3cfa40-metadata.json + * 384326f5-133e-49c8-82ff-30aa19f3cfa40.pdf + * 384327f5-133e-49c8-82ff-30aa19f3cfa40.pagedata + * 384327f5-133e-49c8-82ff-30aa19f3cfa40.thumbnails/0.jpg + +As the .zip file from remarkable is simply a normal .zip file +containing specific file formats. + +You can find some help about the format at the following URL: +https://remarkablewiki.com/tech/filesystem + +Uploading +````````` + +To upload a pdf or epub file, we'll first need to convert it into +the remarkable file format: + + +.. code-block:: python + :linenos: + + + >>> from rmapi.document import ZipDocument + >>> from rmapi.api import Client + >>> rm = Client() + >>> rm.renew_token() + True + >>> rawDocument = ZipDocument(doc="/home/svancampenhout/27-11-2019.pdf") + >>> rawDocument + + >>> rawDocument.metadata["VissibleName"] + '27-11-2019' + +Now we can upload this to a specific folder: + +.. code-block:: python + :linenos: + + + >>> books = [ i for i in rm.get_meta_items() if i.VissibleName == "Boeken" ][0] + >>> rm.upload(rawDocument, books) + True + +And verify its existance: + +.. code-block:: python + :linenos: + + >>> [ i.VissibleName for i in collection.children(books) if i.Type == "DocumentType" ] + ['Origin - Dan Brown', 'Flatland', 'Game Of Thrones', '27-11-2019'] +