24 Commits

Author SHA1 Message Date
dependabot[bot]
aafd2afe08 Bump certifi from 2021.5.30 to 2022.12.7
Bumps [certifi](https://github.com/certifi/python-certifi) from 2021.5.30 to 2022.12.7.
- [Release notes](https://github.com/certifi/python-certifi/releases)
- [Commits](https://github.com/certifi/python-certifi/compare/2021.05.30...2022.12.07)

---
updated-dependencies:
- dependency-name: certifi
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-12-09 05:18:39 +00:00
Rai
45485d4dbf [docs] update registration URL, see https://github.com/subutux/rmapy/issues/28 (#33) 2022-12-06 08:54:11 +01:00
Stijn Van Campenhout
8916261afd bump version 2021-07-23 10:36:50 +02:00
Stijn Van Campenhout
081db1ddc2 Merge remote-tracking branch 'origin/master'
# Conflicts:
#	rmapy/const.py
2021-07-23 10:35:59 +02:00
Stijn Van Campenhout
5c78598271 fix: auth url. See #25 2021-07-23 10:34:17 +02:00
Stijn Van Campenhout
42430b0eb8 🚀 bump version to 0.3.0 2021-07-11 11:38:42 +02:00
Samy Abidib
934e270c6d feat: Add highlight support (#22)
* Add support for downloading highlights
* Add to docs
* Respond to feedback
* Add doc line
* Bug and doc fix

 Thanks @sabidib!
2021-07-11 11:37:20 +02:00
Stijn Van Campenhout
8b120202af fix: fix: CVE-2021-33503 2021-07-11 11:33:54 +02:00
Stijn Van Campenhout
5595ade375 fix: CVE-2021-33503 2021-07-11 11:26:30 +02:00
Stijn Van Campenhout
18865083d7 Merge pull request #21
ZipDocument class vars should be instance vars
2021-05-30 13:27:32 +02:00
Stijn Van Campenhout
10a27bcdb2 Bump version 2021-05-30 15:01:13 +02:00
Stijn Van Campenhout
011cb2f221 Merge pull request #24
Updated the API URL to new domain name
2021-05-30 12:56:16 +02:00
Dan Corne
7e2a3033e0 Updated the API URL to new domain name
This has changed recently and the old domain no longer works.
2021-05-20 19:20:04 +01:00
Samy Abidib
fbc75858d7 ZipDocument class vars should be instance vars 2021-05-11 11:53:32 -04:00
Stijn Van Campenhout
50fef896d3 bump version 2021-03-21 11:14:22 +01:00
dependabot[bot]
a0965d58b3 Bump jinja2 from 2.10.1 to 2.11.3 (#16)
Bumps [jinja2](https://github.com/pallets/jinja) from 2.10.1 to 2.11.3.
- [Release notes](https://github.com/pallets/jinja/releases)
- [Changelog](https://github.com/pallets/jinja/blob/master/CHANGES.rst)
- [Commits](https://github.com/pallets/jinja/compare/2.10.1...2.11.3)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-03-21 11:06:17 +01:00
Reece Mathews
544bd11dd1 Ignore missing files when used with Remarkable 2 (#14)
* Ignore missing thumbnails during dump

* Ignore missing metadata file during load
2021-03-21 11:05:31 +01:00
Stijn Van Campenhout
b5f0367dbb Updated version number 2021-01-30 18:02:43 +01:00
Stijn Van Campenhout
bc36d7b7c6 Updated to latest release 2021-01-30 17:50:49 +01:00
Adeel Khan
15d8090e79 doc: change refresh to renew (#11) 2021-01-30 14:46:21 +01:00
Jacob Kaplan-Moss
8bb29e3bd7 fix(download): Ignore missing thumbnail files (#9)
* Ignore missing thumbnail files

* Change logger name
2021-01-30 14:35:32 +01:00
Stijn Van Campenhout
29d113f3af Added release workflow 2020-11-13 08:16:08 +01:00
ruebeckscube
433eb8e722 Change Collection.items to instance variable (#8)
fix: Change Collection.items to instance variable
2020-11-13 08:10:39 +01:00
Stijn Van Campenhout
7ceac42fdb Merge branch 'bsdz-patch-1' 2020-11-12 16:31:17 +01:00
11 changed files with 348 additions and 209 deletions

31
.github/workflows/python-publish.yml vendored Normal file
View File

@@ -0,0 +1,31 @@
# This workflows will upload a Python Package using Twine when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
name: Upload Python Package
on:
release:
types: [created]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
- name: Build and publish
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python setup.py sdist bdist_wheel
twine upload dist/*

View File

@@ -9,6 +9,7 @@ verify_ssl = true
requests = "*" requests = "*"
pyaml = "*" pyaml = "*"
sphinx = "*" sphinx = "*"
urllib3 = ">=1.26.5"
[requires] [requires]
python_version = "3.7" python_version = "3.7"

288
Pipfile.lock generated
View File

@@ -1,7 +1,7 @@
{ {
"_meta": { "_meta": {
"hash": { "hash": {
"sha256": "880b0f4dc28652bfa8674e7ebeaae37eb25ec47d136a03791bcef5b6f7a5518d" "sha256": "f7fb5bcb7b1ad271a4b43ccd956c97f6d6a530869b7d9b8454aaf4defcadf09f"
}, },
"pipfile-spec": 6, "pipfile-spec": 6,
"requires": { "requires": {
@@ -23,227 +23,271 @@
], ],
"version": "==0.7.12" "version": "==0.7.12"
}, },
"attrs": {
"hashes": [
"sha256:69c0dbf2ed392de1cb5ec704444b08a5ef81680a61cb899dc08127123af36a79",
"sha256:f0b870f674851ecbfbbbd364d6b5cbdff9dcedbc7f3f5e18a6891057f21fe399"
],
"version": "==19.1.0"
},
"babel": { "babel": {
"hashes": [ "hashes": [
"sha256:af92e6106cb7c55286b25b38ad7695f8b4efb36a90ba483d7f7a6628c46158ab", "sha256:1ad3eca1c885218f6dce2ab67291178944f810a10a9b5f3cb8382a5a232b64fe",
"sha256:e86135ae101e31e2c8ec20a4e0c5220f4eed12487d5cf3f78be7e98d3a57fc28" "sha256:5ef4b3226b0180dedded4229651c8b0e1a3a6a2837d45a073272f313e4cf97f6"
], ],
"version": "==2.7.0" "markers": "python_version >= '3.6'",
"version": "==2.11.0"
}, },
"certifi": { "certifi": {
"hashes": [ "hashes": [
"sha256:e4f3620cfea4f83eedc95b24abd9cd56f3c4b146dd0177e83a21b4eb49e21e50", "sha256:35824b4c3a97115964b408844d64aa14db1cc518f6562e8d7261699d1350a9e3",
"sha256:fd7c7c74727ddcf00e9acd26bba8da604ffec95bf1c2144e67aff7a8b50e6cef" "sha256:4ad3232f5e926d6718ec31cfc1fcadfde020920e278684144551c91769c7bc18"
], ],
"version": "==2019.9.11" "index": "pypi",
"version": "==2022.12.7"
}, },
"chardet": { "chardet": {
"hashes": [ "hashes": [
"sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae", "sha256:0d6f53a15db4120f2b08c94f11e7d93d2c911ee118b6b30a04ec3ee8310179fa",
"sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691" "sha256:f864054d66fd9118f2e67044ac8981a54775ec5b67aed0441892edb553d21da5"
], ],
"version": "==3.0.4" "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'",
"version": "==4.0.0"
}, },
"docutils": { "docutils": {
"hashes": [ "hashes": [
"sha256:6c4f696463b79f1fb8ba0c594b63840ebd41f059e92b31957c46b74a4599b6d0", "sha256:686577d2e4c32380bb50cbb22f575ed742d58168cee37e99117a854bcd88f125",
"sha256:9e4d7ecfc600058e07ba661411a2b7de2fd0fafa17d1a7f7361cd47b1175c827", "sha256:cf316c8370a737a022b72b56874f6602acf974a37a9fba42ec2876387549fc61"
"sha256:a2aeea129088da402665e92e0b25b04b073c04b2dce4ab65caaa38b7ce2e1a99"
], ],
"version": "==0.15.2" "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'",
"version": "==0.17.1"
}, },
"idna": { "idna": {
"hashes": [ "hashes": [
"sha256:c357b3f628cf53ae2c4c05627ecc484553142ca23264e593d327bcde5e9c3407", "sha256:b307872f855b18632ce0c21c5e45be78c0ea7ae4c15c828c20788b26921eb3f6",
"sha256:ea8b7f6188e6fa117537c3df7da9fc686d485087abf6ac197f9c46432f7e4a3c" "sha256:b97d804b1e9b523befed77c48dacec60e6dcb0b5391d57af6a65a312a90648c0"
], ],
"version": "==2.8" "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==2.10"
}, },
"imagesize": { "imagesize": {
"hashes": [ "hashes": [
"sha256:3f349de3eb99145973fefb7dbe38554414e5c30abd0c8e4b970a7c9d09f3a1d8", "sha256:0d8d18d08f840c19d0ee7ca1fd82490fdc3729b7ac93f49870406ddde8ef8d8b",
"sha256:f3832918bc3c66617f92e35f5d70729187676313caa60c187eb0f28b8fe5e3b5" "sha256:69150444affb9cb0d5cc5a92b3676f0b2fb7cd9ae39e947a5e11a36b4497cd4a"
], ],
"version": "==1.1.0" "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3'",
"version": "==1.4.1"
}, },
"jinja2": { "jinja2": {
"hashes": [ "hashes": [
"sha256:065c4f02ebe7f7cf559e49ee5a95fb800a9e4528727aec6f24402a5374c65013", "sha256:31351a702a408a9e7595a8fc6150fc3f43bb6bf7e319770cbc0db9df9437e852",
"sha256:14dd6caf1527abb21f08f86c784eac40853ba93edb79552aa1e4b8aef1b61c7b" "sha256:6088930bfe239f0e6710546ab9c19c9ef35e29792895fed6e6e31a023a182a61"
], ],
"version": "==2.10.1" "markers": "python_version >= '3.7'",
"version": "==3.1.2"
}, },
"markupsafe": { "markupsafe": {
"hashes": [ "hashes": [
"sha256:00bc623926325b26bb9605ae9eae8a215691f33cae5df11ca5424f06f2d1f473", "sha256:0212a68688482dc52b2d45013df70d169f542b7394fc744c02a57374a4207003",
"sha256:09027a7803a62ca78792ad89403b1b7a73a01c8cb65909cd876f7fcebd79b161", "sha256:089cf3dbf0cd6c100f02945abeb18484bd1ee57a079aefd52cffd17fba910b88",
"sha256:09c4b7f37d6c648cb13f9230d847adf22f8171b1ccc4d5682398e77f40309235", "sha256:10c1bfff05d95783da83491be968e8fe789263689c02724e0c691933c52994f5",
"sha256:1027c282dad077d0bae18be6794e6b6b8c91d58ed8a8d89a89d59693b9131db5", "sha256:33b74d289bd2f5e527beadcaa3f401e0df0a89927c1559c8566c066fa4248ab7",
"sha256:24982cc2533820871eba85ba648cd53d8623687ff11cbb805be4ff7b4c971aff", "sha256:3799351e2336dc91ea70b034983ee71cf2f9533cdff7c14c90ea126bfd95d65a",
"sha256:29872e92839765e546828bb7754a68c418d927cd064fd4708fab9fe9c8bb116b", "sha256:3ce11ee3f23f79dbd06fb3d63e2f6af7b12db1d46932fe7bd8afa259a5996603",
"sha256:43a55c2930bbc139570ac2452adf3d70cdbb3cfe5912c71cdce1c2c6bbd9c5d1", "sha256:421be9fbf0ffe9ffd7a378aafebbf6f4602d564d34be190fc19a193232fd12b1",
"sha256:46c99d2de99945ec5cb54f23c8cd5689f6d7177305ebff350a58ce5f8de1669e", "sha256:43093fb83d8343aac0b1baa75516da6092f58f41200907ef92448ecab8825135",
"sha256:500d4957e52ddc3351cabf489e79c91c17f6e0899158447047588650b5e69183", "sha256:46d00d6cfecdde84d40e572d63735ef81423ad31184100411e6e3388d405e247",
"sha256:535f6fc4d397c1563d08b88e485c3496cf5784e927af890fb3c3aac7f933ec66", "sha256:4a33dea2b688b3190ee12bd7cfa29d39c9ed176bda40bfa11099a3ce5d3a7ac6",
"sha256:62fe6c95e3ec8a7fad637b7f3d372c15ec1caa01ab47926cfdf7a75b40e0eac1", "sha256:4b9fe39a2ccc108a4accc2676e77da025ce383c108593d65cc909add5c3bd601",
"sha256:6dd73240d2af64df90aa7c4e7481e23825ea70af4b4922f8ede5b9e35f78a3b1", "sha256:56442863ed2b06d19c37f94d999035e15ee982988920e12a5b4ba29b62ad1f77",
"sha256:717ba8fe3ae9cc0006d7c451f0bb265ee07739daf76355d06366154ee68d221e", "sha256:671cd1187ed5e62818414afe79ed29da836dde67166a9fac6d435873c44fdd02",
"sha256:79855e1c5b8da654cf486b830bd42c06e8780cea587384cf6545b7d9ac013a0b", "sha256:694deca8d702d5db21ec83983ce0bb4b26a578e71fbdbd4fdcd387daa90e4d5e",
"sha256:7c1699dfe0cf8ff607dbdcc1e9b9af1755371f92a68f706051cc8c37d447c905", "sha256:6a074d34ee7a5ce3effbc526b7083ec9731bb3cbf921bbe1d3005d4d2bdb3a63",
"sha256:88e5fcfb52ee7b911e8bb6d6aa2fd21fbecc674eadd44118a9cc3863f938e735", "sha256:6d0072fea50feec76a4c418096652f2c3238eaa014b2f94aeb1d56a66b41403f",
"sha256:8defac2f2ccd6805ebf65f5eeb132adcf2ab57aa11fdf4c0dd5169a004710e7d", "sha256:6fbf47b5d3728c6aea2abb0589b5d30459e369baa772e0f37a0320185e87c980",
"sha256:98c7086708b163d425c67c7a91bad6e466bb99d797aa64f965e9d25c12111a5e", "sha256:7f91197cc9e48f989d12e4e6fbc46495c446636dfc81b9ccf50bb0ec74b91d4b",
"sha256:9add70b36c5666a2ed02b43b335fe19002ee5235efd4b8a89bfcf9005bebac0d", "sha256:86b1f75c4e7c2ac2ccdaec2b9022845dbb81880ca318bb7a0a01fbf7813e3812",
"sha256:9bf40443012702a1d2070043cb6291650a0841ece432556f784f004937f0f32c", "sha256:8dc1c72a69aa7e082593c4a203dcf94ddb74bb5c8a731e4e1eb68d031e8498ff",
"sha256:ade5e387d2ad0d7ebf59146cc00c8044acbd863725f887353a10df825fc8ae21", "sha256:8e3dcf21f367459434c18e71b2a9532d96547aef8a871872a5bd69a715c15f96",
"sha256:b00c1de48212e4cc9603895652c5c410df699856a2853135b3967591e4beebc2", "sha256:8e576a51ad59e4bfaac456023a78f6b5e6e7651dcd383bcc3e18d06f9b55d6d1",
"sha256:b1282f8c00509d99fef04d8ba936b156d419be841854fe901d8ae224c59f0be5", "sha256:96e37a3dc86e80bf81758c152fe66dbf60ed5eca3d26305edf01892257049925",
"sha256:b2051432115498d3562c084a49bba65d97cf251f5a331c64a12ee7e04dacc51b", "sha256:97a68e6ada378df82bc9f16b800ab77cbf4b2fada0081794318520138c088e4a",
"sha256:ba59edeaa2fc6114428f1637ffff42da1e311e29382d81b339c1817d37ec93c6", "sha256:99a2a507ed3ac881b975a2976d59f38c19386d128e7a9a18b7df6fff1fd4c1d6",
"sha256:c8716a48d94b06bb3b2524c2b77e055fb313aeb4ea620c8dd03a105574ba704f", "sha256:a49907dd8420c5685cfa064a1335b6754b74541bbb3706c259c02ed65b644b3e",
"sha256:cd5df75523866410809ca100dc9681e301e3c27567cf498077e8551b6d20e42f", "sha256:b09bf97215625a311f669476f44b8b318b075847b49316d3e28c08e41a7a573f",
"sha256:e249096428b3ae81b08327a63a485ad0878de3fb939049038579ac0ef61e17e7" "sha256:b7bd98b796e2b6553da7225aeb61f447f80a1ca64f41d83612e6139ca5213aa4",
"sha256:b87db4360013327109564f0e591bd2a3b318547bcef31b468a92ee504d07ae4f",
"sha256:bcb3ed405ed3222f9904899563d6fc492ff75cce56cba05e32eff40e6acbeaa3",
"sha256:d4306c36ca495956b6d568d276ac11fdd9c30a36f1b6eb928070dc5360b22e1c",
"sha256:d5ee4f386140395a2c818d149221149c54849dfcfcb9f1debfe07a8b8bd63f9a",
"sha256:dda30ba7e87fbbb7eab1ec9f58678558fd9a6b8b853530e176eabd064da81417",
"sha256:e04e26803c9c3851c931eac40c695602c6295b8d432cbe78609649ad9bd2da8a",
"sha256:e1c0b87e09fa55a220f058d1d49d3fb8df88fbfab58558f1198e08c1e1de842a",
"sha256:e72591e9ecd94d7feb70c1cbd7be7b3ebea3f548870aa91e2732960fa4d57a37",
"sha256:e8c843bbcda3a2f1e3c2ab25913c80a3c5376cd00c6e8c4a86a89a28c8dc5452",
"sha256:efc1913fd2ca4f334418481c7e595c00aad186563bbc1ec76067848c7ca0a933",
"sha256:f121a1420d4e173a5d96e47e9a0c0dcff965afdf1626d28de1460815f7c4ee7a",
"sha256:fc7b548b17d238737688817ab67deebb30e8073c95749d55538ed473130ec0c7"
], ],
"version": "==1.1.1" "markers": "python_version >= '3.7'",
"version": "==2.1.1"
}, },
"packaging": { "packaging": {
"hashes": [ "hashes": [
"sha256:a7ac867b97fdc07ee80a8058fe4435ccd274ecc3b0ed61d852d7d53055528cf9", "sha256:2198ec20bd4c017b8f9717e00f0c8714076fc2fd93816750ab48e2c41de2cfd3",
"sha256:c491ca87294da7cc01902edbe30a5bc6c4c28172b5138ab4e4aa1b9d7bfaeafe" "sha256:957e2148ba0e1a3b282772e791ef1d8083648bc131c8ab0c1feba110ce1146c3"
], ],
"version": "==19.1" "markers": "python_version >= '3.7'",
"version": "==22.0"
}, },
"pyaml": { "pyaml": {
"hashes": [ "hashes": [
"sha256:a2dcbc4a8bb00b541efd1c5a064d93474d4f41ded1484fbb08bec9d236523931", "sha256:29a5c2a68660a799103d6949167bd6c7953d031449d08802386372de1db6ad71",
"sha256:c79ae98ececda136a034115ca178ee8bf3aa7df236c488c2f55d12f177b88f1e" "sha256:67081749a82b72c45e5f7f812ee3a14a03b3f5c25ff36ec3b290514f8c4c4b99"
], ],
"index": "pypi", "index": "pypi",
"version": "==19.4.1" "version": "==20.4.0"
}, },
"pygments": { "pygments": {
"hashes": [ "hashes": [
"sha256:71e430bc85c88a430f000ac1d9b331d2407f681d6f6aec95e8bcfbc3df5b0127", "sha256:56a8508ae95f98e2b9bdf93a6be5ae3f7d8af858b43e02c5a2ff083726be40c1",
"sha256:881c4c157e45f30af185c1ffe8d549d48ac9127433f2c380c24b84572ad66297" "sha256:f643f331ab57ba3c9d89212ee4a2dabc6e94f117cf4eefde99a0574720d14c42"
], ],
"version": "==2.4.2" "markers": "python_version >= '3.6'",
}, "version": "==2.13.0"
"pyparsing": {
"hashes": [
"sha256:6f98a7b9397e206d78cc01df10131398f1c8b8510a2f4d97d9abd82e1aacdd80",
"sha256:d9338df12903bbf5d65a0e4e87c2161968b10d2e489652bb47001d82a9b028b4"
],
"version": "==2.4.2"
}, },
"pytz": { "pytz": {
"hashes": [ "hashes": [
"sha256:26c0b32e437e54a18161324a2fca3c4b9846b74a8dccddd843113109e1116b32", "sha256:222439474e9c98fced559f1709d89e6c9cbf8d79c794ff3eb9f8800064291427",
"sha256:c894d57500a4cd2d5c71114aaab77dbab5eabd9022308ce5ac9bb93a60a6f0c7" "sha256:e89512406b793ca39f5971bc999cc538ce125c0e51c27941bef4568b460095e2"
], ],
"version": "==2019.2" "version": "==2022.6"
}, },
"pyyaml": { "pyyaml": {
"hashes": [ "hashes": [
"sha256:0113bc0ec2ad727182326b61326afa3d1d8280ae1122493553fd6f4397f33df9", "sha256:01b45c0191e6d66c470b6cf1b9531a771a83c1c4208272ead47a3ae4f2f603bf",
"sha256:01adf0b6c6f61bd11af6e10ca52b7d4057dd0be0343eb9283c878cf3af56aee4", "sha256:0283c35a6a9fbf047493e3a0ce8d79ef5030852c51e9d911a27badfde0605293",
"sha256:5124373960b0b3f4aa7df1707e63e9f109b5263eca5976c66e08b1c552d4eaf8", "sha256:055d937d65826939cb044fc8c9b08889e8c743fdc6a32b33e2390f66013e449b",
"sha256:5ca4f10adbddae56d824b2c09668e91219bb178a1eee1faa56af6f99f11bf696", "sha256:07751360502caac1c067a8132d150cf3d61339af5691fe9e87803040dbc5db57",
"sha256:7907be34ffa3c5a32b60b95f4d95ea25361c951383a894fec31be7252b2b6f34", "sha256:0b4624f379dab24d3725ffde76559cff63d9ec94e1736b556dacdfebe5ab6d4b",
"sha256:7ec9b2a4ed5cad025c2278a1e6a19c011c80a3caaac804fd2d329e9cc2c287c9", "sha256:0ce82d761c532fe4ec3f87fc45688bdd3a4c1dc5e0b4a19814b9009a29baefd4",
"sha256:87ae4c829bb25b9fe99cf71fbb2140c448f534e24c998cc60f39ae4f94396a73", "sha256:1e4747bc279b4f613a09eb64bba2ba602d8a6664c6ce6396a4d0cd413a50ce07",
"sha256:9de9919becc9cc2ff03637872a440195ac4241c80536632fffeb6a1e25a74299", "sha256:213c60cd50106436cc818accf5baa1aba61c0189ff610f64f4a3e8c6726218ba",
"sha256:a5a85b10e450c66b49f98846937e8cfca1db3127a9d5d1e31ca45c3d0bef4c5b", "sha256:231710d57adfd809ef5d34183b8ed1eeae3f76459c18fb4a0b373ad56bedcdd9",
"sha256:b0997827b4f6a7c286c01c5f60384d218dca4ed7d9efa945c3e1aa623d5709ae", "sha256:277a0ef2981ca40581a47093e9e2d13b3f1fbbeffae064c1d21bfceba2030287",
"sha256:b631ef96d3222e62861443cc89d6563ba3eeb816eeb96b2629345ab795e53681", "sha256:2cd5df3de48857ed0544b34e2d40e9fac445930039f3cfe4bcc592a1f836d513",
"sha256:bf47c0607522fdbca6c9e817a6e81b08491de50f3766a7a0e6a5be7905961b41", "sha256:40527857252b61eacd1d9af500c3337ba8deb8fc298940291486c465c8b46ec0",
"sha256:f81025eddd0327c7d4cfe9b62cf33190e1e736cc6e97502b3ec425f574b3e7a8" "sha256:432557aa2c09802be39460360ddffd48156e30721f5e8d917f01d31694216782",
"sha256:473f9edb243cb1935ab5a084eb238d842fb8f404ed2193a915d1784b5a6b5fc0",
"sha256:48c346915c114f5fdb3ead70312bd042a953a8ce5c7106d5bfb1a5254e47da92",
"sha256:50602afada6d6cbfad699b0c7bb50d5ccffa7e46a3d738092afddc1f9758427f",
"sha256:68fb519c14306fec9720a2a5b45bc9f0c8d1b9c72adf45c37baedfcd949c35a2",
"sha256:77f396e6ef4c73fdc33a9157446466f1cff553d979bd00ecb64385760c6babdc",
"sha256:81957921f441d50af23654aa6c5e5eaf9b06aba7f0a19c18a538dc7ef291c5a1",
"sha256:819b3830a1543db06c4d4b865e70ded25be52a2e0631ccd2f6a47a2822f2fd7c",
"sha256:897b80890765f037df3403d22bab41627ca8811ae55e9a722fd0392850ec4d86",
"sha256:98c4d36e99714e55cfbaaee6dd5badbc9a1ec339ebfc3b1f52e293aee6bb71a4",
"sha256:9df7ed3b3d2e0ecfe09e14741b857df43adb5a3ddadc919a2d94fbdf78fea53c",
"sha256:9fa600030013c4de8165339db93d182b9431076eb98eb40ee068700c9c813e34",
"sha256:a80a78046a72361de73f8f395f1f1e49f956c6be882eed58505a15f3e430962b",
"sha256:afa17f5bc4d1b10afd4466fd3a44dc0e245382deca5b3c353d8b757f9e3ecb8d",
"sha256:b3d267842bf12586ba6c734f89d1f5b871df0273157918b0ccefa29deb05c21c",
"sha256:b5b9eccad747aabaaffbc6064800670f0c297e52c12754eb1d976c57e4f74dcb",
"sha256:bfaef573a63ba8923503d27530362590ff4f576c626d86a9fed95822a8255fd7",
"sha256:c5687b8d43cf58545ade1fe3e055f70eac7a5a1a0bf42824308d868289a95737",
"sha256:cba8c411ef271aa037d7357a2bc8f9ee8b58b9965831d9e51baf703280dc73d3",
"sha256:d15a181d1ecd0d4270dc32edb46f7cb7733c7c508857278d3d378d14d606db2d",
"sha256:d4b0ba9512519522b118090257be113b9468d804b19d63c71dbcf4a48fa32358",
"sha256:d4db7c7aef085872ef65a8fd7d6d09a14ae91f691dec3e87ee5ee0539d516f53",
"sha256:d4eccecf9adf6fbcc6861a38015c2a64f38b9d94838ac1810a9023a0609e1b78",
"sha256:d67d839ede4ed1b28a4e8909735fc992a923cdb84e618544973d7dfc71540803",
"sha256:daf496c58a8c52083df09b80c860005194014c3698698d1a57cbcfa182142a3a",
"sha256:dbad0e9d368bb989f4515da330b88a057617d16b6a8245084f1b05400f24609f",
"sha256:e61ceaab6f49fb8bdfaa0f92c4b57bcfbea54c09277b1b4f7ac376bfb7a7c174",
"sha256:f84fbc98b019fef2ee9a1cb3ce93e3187a6df0b2538a651bfb890254ba9f90b5"
], ],
"version": "==5.1.2" "markers": "python_version >= '3.6'",
"version": "==6.0"
}, },
"requests": { "requests": {
"hashes": [ "hashes": [
"sha256:11e007a8a2aa0323f5a921e9e6a2d7e4e67d9877e85773fba9ba6419025cbeb4", "sha256:27973dd4a904a4f13b263a19c866c13b92a39ed1c964655f025f3f8d3d75b804",
"sha256:9cf5292fcd0f598c671cfc1e0d7d1a7f13bb8085e9a590f48c010551dc6c4b31" "sha256:c210084e36a42ae6b9219e00e48287def368a26d03a048ddad7bfee44f75871e"
], ],
"index": "pypi", "index": "pypi",
"version": "==2.22.0" "version": "==2.25.1"
}, },
"six": { "setuptools": {
"hashes": [ "hashes": [
"sha256:3350809f0555b11f552448330d0b52d5f24c91a322ea4a15ef22629740f3761c", "sha256:57f6f22bde4e042978bcd50176fdb381d7c21a9efa4041202288d3737a0c6a54",
"sha256:d16a0141ec1a18405cd4ce8b4613101da75da0e9a7aec5bdd4fa804d0e0eba73" "sha256:a7620757bf984b58deaf32fc8a4577a9bbc0850cf92c20e1ce41c38c19e5fb75"
], ],
"version": "==1.12.0" "markers": "python_version >= '3.7'",
"version": "==65.6.3"
}, },
"snowballstemmer": { "snowballstemmer": {
"hashes": [ "hashes": [
"sha256:713e53b79cbcf97bc5245a06080a33d54a77e7cce2f789c835a143bcdb5c033e" "sha256:09b16deb8547d3412ad7b590689584cd0fe25ec8db3be37788be3810cbf19cb1",
"sha256:c8e1716e83cc398ae16824e5572ae04e0d9fc2c6b985fb0f900f5f0c96ecba1a"
], ],
"version": "==1.9.1" "version": "==2.2.0"
}, },
"sphinx": { "sphinx": {
"hashes": [ "hashes": [
"sha256:0d586b0f8c2fc3cc6559c5e8fd6124628110514fda0e5d7c82e682d749d2e845", "sha256:5747f3c855028076fcff1e4df5e75e07c836f0ac11f7df886747231092cfe4ad",
"sha256:839a3ed6f6b092bb60f492024489cc9e6991360fb9f52ed6361acd510d261069" "sha256:dff357e6a208eb7edb2002714733ac21a9fe597e73609ff417ab8cf0c6b4fbb8"
], ],
"index": "pypi", "index": "pypi",
"version": "==2.2.0" "version": "==4.0.3"
}, },
"sphinxcontrib-applehelp": { "sphinxcontrib-applehelp": {
"hashes": [ "hashes": [
"sha256:edaa0ab2b2bc74403149cb0209d6775c96de797dfd5b5e2a71981309efab3897", "sha256:806111e5e962be97c29ec4c1e7fe277bfd19e9652fb1a4392105b43e01af885a",
"sha256:fb8dee85af95e5c30c91f10e7eb3c8967308518e0f7488a2828ef7bc191d0d5d" "sha256:a072735ec80e7675e3f432fcae8610ecf509c5f1869d17e2eecff44389cdbc58"
], ],
"version": "==1.0.1" "markers": "python_version >= '3.5'",
"version": "==1.0.2"
}, },
"sphinxcontrib-devhelp": { "sphinxcontrib-devhelp": {
"hashes": [ "hashes": [
"sha256:6c64b077937330a9128a4da74586e8c2130262f014689b4b89e2d08ee7294a34", "sha256:8165223f9a335cc1af7ffe1ed31d2871f325254c0423bc0c4c7cd1c1e4734a2e",
"sha256:9512ecb00a2b0821a146736b39f7aeb90759834b07e81e8cc23a9c70bacb9981" "sha256:ff7f1afa7b9642e7060379360a67e9c41e8f3121f2ce9164266f61b9f4b338e4"
], ],
"version": "==1.0.1" "markers": "python_version >= '3.5'",
"version": "==1.0.2"
}, },
"sphinxcontrib-htmlhelp": { "sphinxcontrib-htmlhelp": {
"hashes": [ "hashes": [
"sha256:4670f99f8951bd78cd4ad2ab962f798f5618b17675c35c5ac3b2132a14ea8422", "sha256:d412243dfb797ae3ec2b59eca0e52dac12e75a241bf0e4eb861e450d06c6ed07",
"sha256:d4fd39a65a625c9df86d7fa8a2d9f3cd8299a3a4b15db63b50aac9e161d8eff7" "sha256:f5f8bb2d0d629f398bf47d0d69c07bc13b65f75a81ad9e2f71a63d4b7a2f6db2"
], ],
"version": "==1.0.2" "markers": "python_version >= '3.6'",
"version": "==2.0.0"
}, },
"sphinxcontrib-jsmath": { "sphinxcontrib-jsmath": {
"hashes": [ "hashes": [
"sha256:2ec2eaebfb78f3f2078e73666b1415417a116cc848b72e5172e596c871103178", "sha256:2ec2eaebfb78f3f2078e73666b1415417a116cc848b72e5172e596c871103178",
"sha256:a9925e4a4587247ed2191a22df5f6970656cb8ca2bd6284309578f2153e0c4b8" "sha256:a9925e4a4587247ed2191a22df5f6970656cb8ca2bd6284309578f2153e0c4b8"
], ],
"markers": "python_version >= '3.5'",
"version": "==1.0.1" "version": "==1.0.1"
}, },
"sphinxcontrib-qthelp": { "sphinxcontrib-qthelp": {
"hashes": [ "hashes": [
"sha256:513049b93031beb1f57d4daea74068a4feb77aa5630f856fcff2e50de14e9a20", "sha256:4c33767ee058b70dba89a6fc5c1892c0d57a54be67ddd3e7875a18d14cba5a72",
"sha256:79465ce11ae5694ff165becda529a600c754f4bc459778778c7017374d4d406f" "sha256:bd9fc24bcb748a8d51fd4ecaade681350aa63009a347a8c14e637895444dfab6"
], ],
"version": "==1.0.2" "markers": "python_version >= '3.5'",
"version": "==1.0.3"
}, },
"sphinxcontrib-serializinghtml": { "sphinxcontrib-serializinghtml": {
"hashes": [ "hashes": [
"sha256:c0efb33f8052c04fd7a26c0a07f1678e8512e0faec19f4aa8f2473a8b81d5227", "sha256:352a9a00ae864471d3a7ead8d7d79f5fc0b57e8b3f95e9867eb9eb28999b92fd",
"sha256:db6615af393650bf1151a6cd39120c29abaf93cc60db8c48eb2dddbfdc3a9768" "sha256:aa5f6de5dfdf809ef505c4895e51ef5c9eac17d0f287933eb49ec495280b6952"
], ],
"version": "==1.1.3" "markers": "python_version >= '3.5'",
"version": "==1.1.5"
}, },
"urllib3": { "urllib3": {
"hashes": [ "hashes": [
"sha256:b246607a25ac80bedac05c6f282e3cdaf3afb65420fd024ac94435cabe6e18d1", "sha256:39fb8672126159acb139a7718dd10806104dec1e2f0f6c88aab05d17df10c8d4",
"sha256:dbe59173209418ae49d485b87d1681aefa36252ee85884c31346debd19463232" "sha256:f57b4c16c62fa2760b7e3d97c35b255512fb6b59a259730f36ba32ce9f8e342f"
], ],
"version": "==1.25.3" "index": "pypi",
"version": "==1.26.6"
} }
}, },
"develop": {} "develop": {}

View File

@@ -14,4 +14,3 @@ This is an (unofficial) Remarkable Cloud API Client written in Python.
* ❎ cli interface * ❎ cli interface
* ❎ export pdf with annotations * ❎ export pdf with annotations

View File

@@ -7,7 +7,7 @@ are re-used because we use the same storage location & format.
If not, you'll need to register the client as a new device on `my remarkable`_. If not, you'll need to register the client as a new device on `my remarkable`_.
.. _my remarkable: https://my.remarkable.com/connect/remarkable .. _my remarkable: https://my.remarkable.com/device/desktop/connect
.. _rmapi: https://github.com/juruen/rmapi .. _rmapi: https://github.com/juruen/rmapi
@@ -30,10 +30,11 @@ and use the code you see on the webpage
# This registers the client as a new device. The received device token is # This registers the client as a new device. The received device token is
# stored in the users directory in the file ~/.rmapi, the same as with the # stored in the users directory in the file ~/.rmapi, the same as with the
# go rmapi client. # go rmapi client.
# Get a token at https://my.remarkable.com/device/desktop/connect.
rmapy.register_device("fkgzzklrs") 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. # a new session.
rmapy.refresh_token() rmapy.renew_token()
# Should return True # Should return True
rmapy.is_auth() rmapy.is_auth()
@@ -175,10 +176,13 @@ Here is the content of an archive retried on the tablet as example:
* 384326f5-133e-49c8-82ff-30aa19f3cfa40.pdf * 384326f5-133e-49c8-82ff-30aa19f3cfa40.pdf
* 384327f5-133e-49c8-82ff-30aa19f3cfa40.pagedata * 384327f5-133e-49c8-82ff-30aa19f3cfa40.pagedata
* 384327f5-133e-49c8-82ff-30aa19f3cfa40.thumbnails/0.jpg * 384327f5-133e-49c8-82ff-30aa19f3cfa40.thumbnails/0.jpg
* 384327f5-133e-49c8-82ff-30aa19f3cfa40.highlights/9b75d8df-1d06-4c59-8f3e-4cf69aa96cd9.json
As the .zip file from remarkable is simply a normal .zip file As the .zip file from remarkable is simply a normal .zip file
containing specific file formats. containing specific file formats.
Highlights are stored in the `{uuid}.highlights/` folder.
You can find some help about the format at the following URL: You can find some help about the format at the following URL:
https://remarkablewiki.com/tech/filesystem https://remarkablewiki.com/tech/filesystem

View File

@@ -3,4 +3,5 @@ pyaml==19.4.1
sphinx==2.2.0 sphinx==2.2.0
sphinx-autodoc-typehints==1.8.0 sphinx-autodoc-typehints==1.8.0
guzzle-sphinx-theme==0.7.11 guzzle-sphinx-theme==0.7.11
urllib3>=1.26.5

View File

@@ -95,12 +95,12 @@ class Client(object):
"""Registers a device on the Remarkable Cloud. """Registers a device on the Remarkable Cloud.
This uses a unique code the user gets from This uses a unique code the user gets from
https://my.remarkable.com/connect/remarkable to register a new device https://my.remarkable.com/device/desktop/connect to register
or client to be able to execute api calls. a new device or client to be able to execute api calls.
Args: Args:
code: A unique One time code the user can get code: A unique One time code the user can get
at https://my.remarkable.com/connect/remarkable . at https://my.remarkable.com/device/desktop/connect.
Returns: Returns:
True True
Raises: Raises:

View File

@@ -15,9 +15,9 @@ class Collection(object):
items: A list containing the items. items: A list containing the items.
""" """
items: List[DocumentOrFolder] = []
def __init__(self, *items: List[DocumentOrFolder]): def __init__(self, *items: List[DocumentOrFolder]):
self.items: List[DocumentOrFolder] = []
for i in items: for i in items:
self.items.append(i) self.items.append(i)

View File

@@ -1,7 +1,8 @@
RFC3339Nano = "%Y-%m-%dT%H:%M:%SZ" RFC3339Nano = "%Y-%m-%dT%H:%M:%SZ"
USER_AGENT = "rmapy" USER_AGENT = "rmapy"
AUTH_BASE_URL = "https://webapp-production-dot-remarkable-production.appspot.com"
BASE_URL = "https://document-storage-production-dot-remarkable-production.appspot.com" # noqa BASE_URL = "https://document-storage-production-dot-remarkable-production.appspot.com" # noqa
DEVICE_TOKEN_URL = "https://my.remarkable.com/token/json/2/device/new" DEVICE_TOKEN_URL = AUTH_BASE_URL + "/token/json/2/device/new"
USER_TOKEN_URL = "https://my.remarkable.com/token/json/2/user/new" USER_TOKEN_URL = AUTH_BASE_URL + "/token/json/2/user/new"
DEVICE = "desktop-windows" DEVICE = "desktop-windows"
SERVICE_MGR_URL = "https://service-manager-production-dot-remarkable-production.appspot.com" # noqa SERVICE_MGR_URL = "https://service-manager-production-dot-remarkable-production.appspot.com" # noqa

View File

@@ -5,9 +5,11 @@ import shutil
from uuid import uuid4 from uuid import uuid4
import json import json
from typing import TypeVar, List, Tuple from typing import TypeVar, List, Tuple
from logging import getLogger
from requests import Response from requests import Response
from .meta import Meta from .meta import Meta
log = getLogger("rmapy")
BytesOrString = TypeVar("BytesOrString", BytesIO, str) BytesOrString = TypeVar("BytesOrString", BytesIO, str)
@@ -40,6 +42,33 @@ class RmPage(object):
"""String representation of this object""" """String representation of this object"""
return self.__str__() return self.__str__()
class Highlight(object):
""" Highlight represents all highlights on a page created using the highligher pen
in EPUB documents.
Functionality introduced in Remarkable 2.7 software.
Contains the page_id where the highlights are located and the highlights
metadata for the page from the Remarkable Cloud.
Corresponds to single .json file in the .highlights/ folder.
Attributes:
page_id: The ID of the page where the highlight is located.
highlight_data: A dictionary containing all highlight data.
"""
def __init__(self, page_id: str, highlight_data: str):
self.page_id = page_id
self.highlight_data = json.loads(highlight_data)
def __str__(self) -> str:
"""String representation of this object"""
return f"<rmapy.document.Highlight {self.page_id}>"
def __repr__(self) -> str:
"""String representation of this object"""
return self.__str__()
class Document(Meta): class Document(Meta):
""" Document represents a real object expected in most """ Document represents a real object expected in most
@@ -88,6 +117,7 @@ class ZipDocument(object):
* 384326f5-133e-49c8-82ff-30aa19f3cfa40.rm * 384326f5-133e-49c8-82ff-30aa19f3cfa40.rm
* 384327f5-133e-49c8-82ff-30aa19f3cfa40.pagedata * 384327f5-133e-49c8-82ff-30aa19f3cfa40.pagedata
* 384327f5-133e-49c8-82ff-30aa19f3cfa40.thumbnails/0.jpg * 384327f5-133e-49c8-82ff-30aa19f3cfa40.thumbnails/0.jpg
* 384327f5-133e-49c8-82ff-30aa19f3cfa40.highlights/9b75d8df-1d06-4c59-8f3e-4cf69aa96cd9.json
As the .zip file from remarkable is simply a normal .zip file As the .zip file from remarkable is simply a normal .zip file
containing specific file formats, this package is a helper to containing specific file formats, this package is a helper to
@@ -104,6 +134,7 @@ class ZipDocument(object):
Attributes: Attributes:
content: Sane defaults for the .content file in the zip. content: Sane defaults for the .content file in the zip.
metadata: parameters describing this blob. metadata: parameters describing this blob.
highlights: list of contents of the .highlights folder
pagedata: the content of the .pagedata file. pagedata: the content of the .pagedata file.
zipfile: The raw zipfile in memory. zipfile: The raw zipfile in memory.
pdf: the raw pdf file if there is one. pdf: the raw pdf file if there is one.
@@ -111,73 +142,6 @@ class ZipDocument(object):
rm: A list of :class:rmapy.document.RmPage in this zip. rm: A list of :class:rmapy.document.RmPage in this zip.
""" """
# {"extraMetadata": {},
# "fileType": "pdf",
# "pageCount": 0,
# "lastOpenedPage": 0,
# "lineHeight": -1,
# "margins": 180,
# "textScale": 1,
# "transform": {}}
content = {
"extraMetadata": {
# "LastBrushColor": "Black",
# "LastBrushThicknessScale": "2",
# "LastColor": "Black",
# "LastEraserThicknessScale": "2",
# "LastEraserTool": "Eraser",
# "LastPen": "Ballpoint",
# "LastPenColor": "Black",
# "LastPenThicknessScale": "2",
# "LastPencil": "SharpPencil",
# "LastPencilColor": "Black",
# "LastPencilThicknessScale": "2",
# "LastTool": "SharpPencil",
# "ThicknessScale": "2"
},
# "FileType": "",
# "FontName": "",
"lastOpenedPage": 0,
"lineHeight": -1,
"margins": 180,
# "Orientation": "portrait",
"pageCount": 0,
# "Pages": [],
"textScale": 1,
"transform": {
# "M11": 1,
# "M12": 0,
# "M13": 0,
# "M21": 0,
# "M22": 1,
# "M23": 0,
# "M31": 0,
# "M32": 0,
# "M33": 1,
}
}
metadata = {
"deleted": False,
"lastModified": "1568368808000",
"metadatamodified": False,
"modified": False,
"parent": "",
"pinned": False,
"synced": True,
"type": "DocumentType",
"version": 1,
"VissibleName": "New Document"
}
pagedata = "b''"
zipfile = BytesIO()
pdf = None
epub = None
rm: List[RmPage] = []
ID = None
def __init__(self, _id=None, doc=None, file=None): def __init__(self, _id=None, doc=None, file=None):
"""Create a new instance of a ZipDocument """Create a new instance of a ZipDocument
@@ -186,6 +150,75 @@ class ZipDocument(object):
doc: a raw pdf, epub or rm (.lines) file. doc: a raw pdf, epub or rm (.lines) file.
file: a zipfile to convert from file: a zipfile to convert from
""" """
# {"extraMetadata": {},
# "fileType": "pdf",
# "pageCount": 0,
# "lastOpenedPage": 0,
# "lineHeight": -1,
# "margins": 180,
# "textScale": 1,
# "transform": {}}
self.content = {
"extraMetadata": {
# "LastBrushColor": "Black",
# "LastBrushThicknessScale": "2",
# "LastColor": "Black",
# "LastEraserThicknessScale": "2",
# "LastEraserTool": "Eraser",
# "LastPen": "Ballpoint",
# "LastPenColor": "Black",
# "LastPenThicknessScale": "2",
# "LastPencil": "SharpPencil",
# "LastPencilColor": "Black",
# "LastPencilThicknessScale": "2",
# "LastTool": "SharpPencil",
# "ThicknessScale": "2"
},
# "FileType": "",
# "FontName": "",
"lastOpenedPage": 0,
"lineHeight": -1,
"margins": 180,
# "Orientation": "portrait",
"pageCount": 0,
# "Pages": [],
"textScale": 1,
"transform": {
# "M11": 1,
# "M12": 0,
# "M13": 0,
# "M21": 0,
# "M22": 1,
# "M23": 0,
# "M31": 0,
# "M32": 0,
# "M33": 1,
}
}
self.metadata = {
"deleted": False,
"lastModified": "1568368808000",
"metadatamodified": False,
"modified": False,
"parent": "",
"pinned": False,
"synced": True,
"type": "DocumentType",
"version": 1,
"VissibleName": "New Document"
}
self.pagedata = "b''"
self.zipfile = BytesIO()
self.pdf = None
self.epub = None
self.rm: List[RmPage] = []
self.ID = None
self.highlights: List[Highlight] = []
if not _id: if not _id:
_id = str(uuid4()) _id = str(uuid4())
self.ID = _id self.ID = _id
@@ -251,6 +284,10 @@ class ZipDocument(object):
zf.writestr(f"{self.ID}.epub", zf.writestr(f"{self.ID}.epub",
self.epub.read()) self.epub.read())
for highlight in self.highlights:
zf.writestr(f"{self.ID}.highlights/{highlight.page_id}.json",
json.dumps(highlight.highlight_data))
for page in self.rm: for page in self.rm:
zf.writestr(f"{self.ID}/{page.order}.rm", zf.writestr(f"{self.ID}/{page.order}.rm",
@@ -259,8 +296,12 @@ class ZipDocument(object):
zf.writestr(f"{self.ID}/{page.order}-metadata.json", zf.writestr(f"{self.ID}/{page.order}-metadata.json",
json.dumps(page.metadata)) json.dumps(page.metadata))
page.page.seek(0) page.page.seek(0)
zf.writestr(f"{self.ID}.thumbnails/{page.order}.jpg", try:
page.thumbnail.read()) zf.writestr(f"{self.ID}.thumbnails/{page.order}.jpg",
page.thumbnail.read())
except AttributeError:
log.debug(f"missing thumbnail during dump: {self.ID}: {page.order}")
pass
if isinstance(file, BytesIO): if isinstance(file, BytesIO):
file.seek(0) file.seek(0)
@@ -310,8 +351,15 @@ class ZipDocument(object):
except KeyError: except KeyError:
pass pass
# Get the RM pages # Get Highlights
highlights = [x for x in zf.namelist()
if x.startswith(f"{self.ID}.highlights/") and x.endswith('.json')]
for highlight in highlights:
with zf.open(highlight, 'r') as highlight_fp:
page_id = highlight.replace(f"{self.ID}.highlights/", "").replace(".json", "")
self.highlights.append(Highlight(page_id, highlight_fp.read()))
# Get the RM pages
pages = [x for x in zf.namelist() pages = [x for x in zf.namelist()
if x.startswith(f"{self.ID}/") and x.endswith('.rm')] if x.startswith(f"{self.ID}/") and x.endswith('.rm')]
for p in pages: for p in pages:
@@ -320,13 +368,23 @@ class ZipDocument(object):
with zf.open(p, 'r') as rm: with zf.open(p, 'r') as rm:
page = BytesIO(rm.read()) page = BytesIO(rm.read())
page.seek(0) page.seek(0)
with zf.open(p.replace(".rm", "-metadata.json"), 'r') as md:
metadata = json.load(md) p_meta = p.replace(".rm", "-metadata.json")
try:
with zf.open(p_meta, 'r') as md:
metadata = json.load(md)
except KeyError:
log.debug(f"missing metadata: {p_meta}")
metadata = None
thumbnail_name = p.replace(".rm", ".jpg") thumbnail_name = p.replace(".rm", ".jpg")
thumbnail_name = thumbnail_name.replace("/", ".thumbnails/") thumbnail_name = thumbnail_name.replace("/", ".thumbnails/")
with zf.open(thumbnail_name, 'r') as tn: try:
thumbnail = BytesIO(tn.read()) with zf.open(thumbnail_name, 'r') as tn:
thumbnail.seek(0) 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.rm.append(RmPage(page, metadata, page_number, thumbnail,
self.ID)) self.ID))

View File

@@ -37,7 +37,7 @@ setup(
# For a discussion on single-sourcing the version across setup.py and the # For a discussion on single-sourcing the version across setup.py and the
# project code, see # project code, see
# https://packaging.python.org/en/latest/single_source_version.html # https://packaging.python.org/en/latest/single_source_version.html
version='0.2.2', # Required version='0.3.1', # Required
# This is a one-line description or tagline of what your project does. This # This is a one-line description or tagline of what your project does. This
# corresponds to the "Summary" metadata field: # corresponds to the "Summary" metadata field: