darkphoenix / tolino-calibre-sync

Access to tolino cloud with Python 3 and Calibre
GNU Lesser General Public License v2.1
52 stars 7 forks source link

Convert this into a Calibre Plugin for easier setup and use #4

Closed IchBinGROOT closed 2 years ago

IchBinGROOT commented 2 years ago

This seems to solve exactly the problem I started with, but I now face a new one: My main calibre installation is in a docker container on a NAS as I use it to host a calibre web interface and content delivery server inside my local network. I own so many ebooks in so many different file types that I do not want all of them to sync to my tolino cloud as I e.g. would never read my university lecture scripts which I only have in pdf format with many images (i.e. the file has something like 300mb) in black and white on my tolino. Still I want to manage all literature from my university using calibre as I really like the interface and the possibility to put them into virtual libraries and so on.

Thus it would be great to have a plugin that I can directly install into the running calibre installation, configure it in there to connect to my tolino cloud and then have a menu icon/option in the calibre main interface like the one "send by e-mail" that sends that specific one (or the selected ones) to my tolino cloud.

Have you something like this planned, or is it an option to consider?

darkphoenix commented 2 years ago

I've considered turning it into a plugin before, but honestly I can't be bothered to figure out the intricacies of the plugin API, and it's expressly useless to what I made this tool for, which is running it on a server (which has a synced copy of my Calibre library) as a cronjob to keep things in sync. So I appreciate your idea, but it's probably not something I'll get around to any time soon. If you're willing to figure it out yourself, you could probably either reuse some of the code, or just write a Calibre plugin that calls tolinoclient.py on the command line, as it has a simple upload command - alternatively just scripting that command outside of Calibre could get you a similar result, it just takes an ePub if I recall correctly. As an alternate idea, I could (at some point, I'm a bit busy right now) introduce an option to configure filters, e.g. only upload from a specific series, or ignore a specific series, if that would be helpful to your use case.

IchBinGROOT commented 2 years ago

Thank you very much for this really fast answer. I understand that you intended this for a different purpose, it's just that I have had a very bad experience with other clients/software interacting with a calibre instance, I once lost all (manually added) metadata on series and so on during a backup process over network. If I have time to do so (at the moment I should be learning for my next exam on saturday...) I will look into the tolinoclient.py project, but I have no idea how calibre plugins are written.

darkphoenix commented 2 years ago

it's just that I have had a very bad experience with other clients/software interacting with a calibre instance, I once lost all (manually added) metadata on series and so on during a backup process over network. Fair concern. Calibre's database format is a bit messy - I'd like to promise my program won't do anything, and I can tell you I'm certainly not writing anything to the database, but honestly I've no clue what exactly the APIs I use do internally. FWIW since it is a one way sync, you could probably run tolino-calibre-sync on a copy (just rsync your existing library to another place) so if it breaks anything it won't touch your main library. Alternatively, you can do whatever you need using a custom bash script or something - tolinoclient.py (in this same repository) is a simple Tolino API client that doesn't interact with Calibre's database at all. It will handle the auth using the same config file as tolino-calibre-sync.py, but it has simpler commands. Unfortunately it doesn't have any means of preventing double uploads, so "tolinoclient.py upload somefile.epub" will just dump the file into your cloud even if it already exists, but it may well be useful to you anyway. If you have any questions or issues going down that path I'd be happy to help you out, too.

IchBinGROOT commented 2 years ago

Well, then thank you again, if I have some time to spare while preparing for the next exams I will probably go over your code once and pull all the things that look interesting (i.e. probably the authentication and duplicate checking stuff) and then look into the tolinoclient.py implementation.