Skip to content

Commit

Permalink
Use rmapi instead of rmapy for uploading files
Browse files Browse the repository at this point in the history
  • Loading branch information
hansegucker committed Jan 12, 2021
1 parent 47fae18 commit e28e5f1
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
Changelog
=========

v1.0-beta4
----------
* Use rmapi for uploading documents instead of rmapy because files uploaded by rmapy seems to be corrupt sometimes

v1.0-beta3
----------
* Rerun webdav operations in case of failure
Expand Down
20 changes: 14 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,29 @@ This is a small tool to sync webdav files (only PDF) to the reMarkable cloud (on
Setup (dev)
-----------

1. Clone from Git
1. Get rmapi (Go CLI application)

see instructions at https://github.com/juruen/rmapi

2. Clone from Git

.. code-block::
git clone [email protected]:hansegucker/remarkdav.git
2. Get poetry
3. Get poetry

See instructions at https://python-poetry.org/docs/#installation


3. Install dependencies
4. Install dependencies

.. code-block::
$ cd remarkdav/ # Go to your cloned directory
$ poetry install
3. Run
5. Run

.. code-block::
Expand All @@ -32,13 +36,17 @@ See instructions at https://python-poetry.org/docs/#installation
Setup (production)
------------------

1. Get it via poetry (use pip with Python 3)
1. Get rmapi (Go CLI application)

see instructions at https://github.com/juruen/rmapi

2. Get it via poetry (use pip with Python 3)

.. code-block::
$ sudo pip install -G remarkdav
2. Run
3. Run

.. code-block::
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "remarkdav"
version = "1.0-beta3"
version = "1.0-beta4"
description = "A tool to sync webdav files (only PDF) to the reMarkable cloud"
authors = ["Jonathan Weth <[email protected]>"]

Expand Down
11 changes: 5 additions & 6 deletions remarkdav/cli.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import shutil
import subprocess # noqa
import tempfile
import time
from threading import Thread
Expand Down Expand Up @@ -200,14 +201,12 @@ def sync():
# Get necessary folders and the filename
path_split = file.upload_path.split("/")
folders = [mapping["base_folder"]] + path_split[:-1]
filename = path_split[-1]

upload_folder = create_folders(rmapy, *folders)
create_folders(rmapy, *folders)

# Upload new document to cloud
doc = ZipDocument(doc=os.path.abspath(file.local_path))
doc.metadata["VissibleName"] = filename.split(".")[0]
rmapy.upload(doc, upload_folder)
# Upload new document to cloud using rmapi
folder_path = "/" + "/".join(folders)
subprocess.run(["rmapi", "put", os.path.abspath(file.local_path), folder_path]) # noqa

# Save sync status
file.uploaded = True
Expand Down

0 comments on commit e28e5f1

Please sign in to comment.