diff options
| author | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2019-02-14 10:43:49 +0000 |
|---|---|---|
| committer | Gertjan van den Burg <gertjanvandenburg@gmail.com> | 2019-02-14 10:43:49 +0000 |
| commit | d34f7af05e95bdd8857aab7c6bf62f4c937a85fe (patch) | |
| tree | c817188299f3cee932d19732694faf5f5530a928 /arxiv2remarkable.py | |
| parent | Add CLI flag to specify the destination directory on rM (diff) | |
| download | paper2remarkable-d34f7af05e95bdd8857aab7c6bf62f4c937a85fe.tar.gz paper2remarkable-d34f7af05e95bdd8857aab7c6bf62f4c937a85fe.zip | |
Bugfix for directory creation
rMapi was failing when the target directory had a
trailing "/", so we always strip that now.
Diffstat (limited to 'arxiv2remarkable.py')
| -rwxr-xr-x | arxiv2remarkable.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/arxiv2remarkable.py b/arxiv2remarkable.py index b09bace..2f7ffe1 100755 --- a/arxiv2remarkable.py +++ b/arxiv2remarkable.py @@ -214,15 +214,18 @@ def generate_filename(info): def upload_to_rm(filepath, remarkable_dir="/", rmapi_path="rmapi"): + remarkable_dir = remarkable_dir.rstrip("/") logger.info("Starting upload to reMarkable") - if not remarkable_dir == "/": - status = subprocess.call([rmapi_path, "mkdir", remarkable_dir]) + if remarkable_dir: + status = subprocess.call( + [rmapi_path, "mkdir", remarkable_dir], stdout=subprocess.DEVNULL + ) if not status == 0: exception( "Creating directory %s on reMarkable failed" % remarkable_dir ) status = subprocess.call( - [rmapi_path, "put", filepath, remarkable_dir], + [rmapi_path, "put", filepath, remarkable_dir + "/"], stdout=subprocess.DEVNULL, ) if not status == 0: |
