Both of those a possible using calibredb
And the calibre server has a JSON API that allows you to get pretty much any data nad perform pretty much any operation you like on a calibre server (this is the api that calibredb uses to conenct to calibre servers).
|