subutux / rmapy

A unofficial python module for interacting with the Remarkable Cloud
http://rmapy.readthedocs.io/
MIT License
123 stars 47 forks source link

Metadata json file not added to zip file #36

Open alpianon opened 1 year ago

alpianon commented 1 year ago

I just started using my brand new Remarkable and I would like to set up a solution in order to avoid using remarkable cloud, and use my own private cloud instead.

I started playing with rmapy, it seems an excellent project with almost all I need, thanks for the awesome work!

Just, I noticed that when dumping a zip file (eg. created from a pdf file), rmapy does not include the metadata json file. This prevents xochitl from "seeing" the notebook when I manually upload its (uncompressed) contents into ~/.local/share/remarkable/xochitl. But if I add the following line to rmapy.document.ZipDocument.dump():

            zf.writestr(f"{self.ID}.metadata", json.dumps(self.metadata))

it works as expected (i.e. I see the file in xochitl).

Moreover the VissibleName key in metadata dict created by rmapy.document.ZipDocument seems to be wrong, and actually if I leave as it is, I see the uploaded file but it has an empty name in xochitl. If I change it to visibleName it works as expected (i.e. I see the file with its name).

Are these two things on purpose (eg. they are needed to make things work with remarkable cloud) or are they bugs/typos?

(I already answered myself to the second question having a look at https://github.com/splitbrain/ReMarkableAPI/wiki/Storage :slightly_smiling_face: : it's not a bug, the typo is in the remarkable cloud API; the metadata json schema is slightly different from the one used within the device...)