aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Delaere <christophe.delaere@uclouvain.be>2020-04-01 09:13:48 +0200
committerChristophe Delaere <christophe.delaere@uclouvain.be>2020-04-01 09:13:48 +0200
commit721cf5ffb2ebac345f405dd2b2e0d38ba8a3e1ae (patch)
tree1cae51e3ce81ba90f128e5ffafa011a04fb893d7
parentclean makefile (diff)
downloadpaper2remarkable-721cf5ffb2ebac345f405dd2b2e0d38ba8a3e1ae.tar.gz
paper2remarkable-721cf5ffb2ebac345f405dd2b2e0d38ba8a3e1ae.zip
replaced pdftk by qpdf
-rw-r--r--paper2remarkable/providers/_base.py4
-rw-r--r--paper2remarkable/providers/arxiv.py11
-rw-r--r--paper2remarkable/ui.py8
-rw-r--r--paper2remarkable/utils.py1
4 files changed, 12 insertions, 12 deletions
diff --git a/paper2remarkable/providers/_base.py b/paper2remarkable/providers/_base.py
index 96fb151..fbe5308 100644
--- a/paper2remarkable/providers/_base.py
+++ b/paper2remarkable/providers/_base.py
@@ -42,7 +42,7 @@ class Provider(metaclass=abc.ABCMeta):
remarkable_dir="/",
rmapi_path="rmapi",
pdftoppm_path="pdftoppm",
- pdftk_path="pdftk",
+ qpdf_path="qpdf",
gs_path="gs",
cookiejar=None,
):
@@ -51,7 +51,7 @@ class Provider(metaclass=abc.ABCMeta):
self.remarkable_dir = remarkable_dir
self.rmapi_path = rmapi_path
self.pdftoppm_path = pdftoppm_path
- self.pdftk_path = pdftk_path
+ self.qpdf_path = qpdf_path
self.gs_path = gs_path
self.informer = Informer()
self.cookiejar = cookiejar
diff --git a/paper2remarkable/providers/arxiv.py b/paper2remarkable/providers/arxiv.py
index 913e015..06bfdec 100644
--- a/paper2remarkable/providers/arxiv.py
+++ b/paper2remarkable/providers/arxiv.py
@@ -75,16 +75,15 @@ class Arxiv(Provider):
status = subprocess.call(
[
- self.pdftk_path,
+ self.qpdf_path,
+ "--stream-data=uncompress",
input_file,
- "output",
uncompress_file,
- "uncompress",
]
)
if not status == 0:
raise CalledProcessError(
- "pdftk failed to uncompress the PDF file."
+ "qpdf failed to uncompress the PDF file."
)
with open(uncompress_file, "rb") as fid:
@@ -104,9 +103,9 @@ class Arxiv(Provider):
output_file = basename + "_dearxiv.pdf"
status = subprocess.call(
- [self.pdftk_path, removed_file, "output", output_file, "compress"]
+ [self.qpdf_path, "--stream-data=compress", removed_file, output_file]
)
if not status == 0:
- raise CalledProcessError("pdftk failed to compress the PDF file.")
+ raise CalledProcessError("qpdf failed to compress the PDF file.")
return output_file
diff --git a/paper2remarkable/ui.py b/paper2remarkable/ui.py
index 12443d4..e17bffb 100644
--- a/paper2remarkable/ui.py
+++ b/paper2remarkable/ui.py
@@ -89,9 +89,9 @@ def parse_args():
default="pdftoppm",
)
parser.add_argument(
- "--pdftk",
- help="path to pdftk executable (default: pdftk)",
- default="pdftk",
+ "--qpdf",
+ help="path to qpdf executable (default: qpdf)",
+ default="qpdf",
)
parser.add_argument(
"--rmapi",
@@ -158,7 +158,7 @@ def main():
remarkable_dir=args.remarkable_dir,
rmapi_path=args.rmapi,
pdftoppm_path=args.pdftoppm,
- pdftk_path=args.pdftk,
+ qpdf_path=args.qpdf,
gs_path=args.gs,
cookiejar=cookiejar,
)
diff --git a/paper2remarkable/utils.py b/paper2remarkable/utils.py
index 592dcd3..f1447d9 100644
--- a/paper2remarkable/utils.py
+++ b/paper2remarkable/utils.py
@@ -148,6 +148,7 @@ def upload_to_remarkable(filepath, remarkable_dir="/", rmapi_path="rmapi"):
)
# Upload the file
+ logger.info("%s put %s %s/"%(rmapi_path,filepath,remarkable_dir))
status = subprocess.call(
[rmapi_path, "put", filepath, remarkable_dir + "/"],
stdout=subprocess.DEVNULL,