mirror of
https://github.com/subutux/rmapy.git
synced 2025-12-09 15:05:35 +00:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b5f0367dbb | ||
|
|
bc36d7b7c6 | ||
|
|
15d8090e79 | ||
|
|
8bb29e3bd7 |
@@ -14,4 +14,3 @@ This is an (unofficial) Remarkable Cloud API Client written in Python.
|
||||
* ❎ cli interface
|
||||
* ❎ export pdf with annotations
|
||||
|
||||
|
||||
|
||||
@@ -31,9 +31,9 @@ and use the code you see on the webpage
|
||||
# stored in the users directory in the file ~/.rmapi, the same as with the
|
||||
# go rmapi client.
|
||||
rmapy.register_device("fkgzzklrs")
|
||||
# It's always a good idea to refresh the user token every time you start
|
||||
# It's always a good idea to renew the user token every time you start
|
||||
# a new session.
|
||||
rmapy.refresh_token()
|
||||
rmapy.renew_token()
|
||||
# Should return True
|
||||
rmapy.is_auth()
|
||||
|
||||
|
||||
@@ -5,9 +5,11 @@ import shutil
|
||||
from uuid import uuid4
|
||||
import json
|
||||
from typing import TypeVar, List, Tuple
|
||||
from logging import getLogger
|
||||
from requests import Response
|
||||
from .meta import Meta
|
||||
|
||||
log = getLogger("rmapy")
|
||||
BytesOrString = TypeVar("BytesOrString", BytesIO, str)
|
||||
|
||||
|
||||
@@ -311,7 +313,6 @@ class ZipDocument(object):
|
||||
pass
|
||||
|
||||
# Get the RM pages
|
||||
|
||||
pages = [x for x in zf.namelist()
|
||||
if x.startswith(f"{self.ID}/") and x.endswith('.rm')]
|
||||
for p in pages:
|
||||
@@ -322,11 +323,16 @@ class ZipDocument(object):
|
||||
page.seek(0)
|
||||
with zf.open(p.replace(".rm", "-metadata.json"), 'r') as md:
|
||||
metadata = json.load(md)
|
||||
|
||||
thumbnail_name = p.replace(".rm", ".jpg")
|
||||
thumbnail_name = thumbnail_name.replace("/", ".thumbnails/")
|
||||
with zf.open(thumbnail_name, 'r') as tn:
|
||||
thumbnail = BytesIO(tn.read())
|
||||
thumbnail.seek(0)
|
||||
try:
|
||||
with zf.open(thumbnail_name, 'r') as tn:
|
||||
thumbnail = BytesIO(tn.read())
|
||||
thumbnail.seek(0)
|
||||
except KeyError:
|
||||
log.debug(f"missing thumbnail: {thumbnail_name}")
|
||||
thumbnail = None
|
||||
|
||||
self.rm.append(RmPage(page, metadata, page_number, thumbnail,
|
||||
self.ID))
|
||||
|
||||
2
setup.py
2
setup.py
@@ -37,7 +37,7 @@ setup(
|
||||
# For a discussion on single-sourcing the version across setup.py and the
|
||||
# project code, see
|
||||
# https://packaging.python.org/en/latest/single_source_version.html
|
||||
version='0.2.2', # Required
|
||||
version='0.2.3', # Required
|
||||
|
||||
# This is a one-line description or tagline of what your project does. This
|
||||
# corresponds to the "Summary" metadata field:
|
||||
|
||||
Reference in New Issue
Block a user