View Single Post
Old 05-13-2021, 09:26 AM   #1
ta264
Junior Member
ta264 began at the beginning.
 
Posts: 4
Karma: 10
Join Date: May 2021
Device: Kindle Oasis
Updated filenames not shown in API response

Hi,

I'm working on an application that interfaces with the calibre content server API. I think I've either hit a bug or misunderstood how to use the API so any advice would be appreciated.

Suppose I have a book in my calibre library with the incorrect author. In this case, it's 'Dichronauts', which has Isaac Asimov as the author in my library but it should be Greg Egan.

My application recognises this and sends a POST to /cdb/set-fields to correct the author. This works, and I get back the following response:
Code:
2021-05-12 15:21:57.9|Trace|HttpClient|Res: [POST] http://192.168.100.3:8089/cdb/set-fields/191/config: 200.OK (2114 ms)
2021-05-12 15:21:57.9|Trace|HttpClient|Response content (2111 bytes): {"191": {"formats": ["AZW3", "EPUB", "MOBI"], "format_sizes": {"AZW3": 479036, "EPUB": 381443, "MOBI": 461780}, "authors": ["Greg Egan"], "languages": ["eng"], "publisher": "Night Shade Books", "rating": 7, "identifiers": {"goodreads": "30351492"}, "author_sort": "Egan, Greg", "comments": "<p class=\"description\">Seth is a surveyor, along with his friend Theo, a leech-like creature running through his skull who tells Seth what lies to his left and right. Theo, in turn, relies on Seth for mobility, and for ordinary vision looking forwards and backwards. Like everyone else in their world, they are symbionts, depending on each other to survive.<br/><br/>In the universe containing Seth's world, light cannot travel in all directions: there is a “dark cone” to the north and south. Seth can only face to the east (or the west, if he tips his head backwards). If he starts to turn to the north or south, his body stretches out across the landscape, and to rotate as far as north-north-east is every bit as impossible as accelerating to the speed of light.<br/><br/>Every living thing in Seth’s world is in a state of perpetual migration as they follow the sun’s shifting orbit and the narrow habitable zone it creates. Cities are being constantly disassembled at one edge and rebuilt at the other, with surveyors mapping safe routes ahead.<br/><br/>But when Seth and Theo join an expedition to the edge of the habitable zone, they discover a terrifying threat: a fissure in the surface of the world, so deep and wide that no one can perceive its limits. As the habitable zone continues to move, the migration will soon be blocked by this unbridgeable void, and the expedition has only one option to save its city from annihilation: descend into the unknown.<br/></p>", "last_modified": "2021-05-12T14:21:57.390136+00:00", "pubdate": "2017-07-11T00:00:00+00:00", "series_index": 1.0, "sort": "Dichronauts", "size": 479036, "timestamp": "2020-08-20T08:18:39+00:00", "title": "Dichronauts", "uuid": "76a5eab5-fb2e-4f46-ac85-24cb7e6aa5f3", "urls_from_identifiers": [], "lang_names": {"eng": "English"}}}
The author is updated to Greg Egan as expected. However, since the author has changed, calibre moves the files on disk. I can see that on disk the file has moved from:
Code:
/config/Isaac Asimov/Dichronauts (191)/Dichronauts - Isaac Asimov.epub
to:
Code:
/config/Greg Egan/Dichronauts (191)/Dichronauts - Isaac Asimov.epub
My application knows that the file might move, and wants to track this, so it calls to /ajax/book to get the updated path:
Code:
2021-05-12 15:22:11.9|Trace|HttpClient|Res: [GET] http://192.168.100.3:8089/ajax/book/191/config: 200.OK (21 ms)
2021-05-12 15:22:11.9|Trace|HttpClient|Response content (3081 bytes): {"identifiers": {"goodreads": "30351492"}, "author_sort": "Egan, Greg", "title_sort": "Dichronauts", "thumbnail": "/calibre/get/thumb/191/config", "uuid": "76a5eab5-fb2e-4f46-ac85-24cb7e6aa5f3", "comments": "Seth is a surveyor, along with his friend Theo, a leech-like creature running through his skull who tells Seth what lies to his left and right. Theo, in turn, relies on Seth for mobility, and for ordinary vision looking forwards and backwards. Like everyone else in their world, they are symbionts, depending on each other to survive.<br /><br />In the universe containing Seth's world, light cannot travel in all directions: there is a “dark cone” to the north and south. Seth can only face to the east (or the west, if he tips his head backwards). If he starts to turn to the north or south, his body stretches out across the landscape, and to rotate as far as north-north-east is every bit as impossible as accelerating to the speed of light.<br /><br />Every living thing in Seth’s world is in a state of perpetual migration as they follow the sun’s shifting orbit and the narrow habitable zone it creates. Cities are being constantly disassembled at one edge and rebuilt at the other, with surveyors mapping safe routes ahead.<br /><br />But when Seth and Theo join an expedition to the edge of the habitable zone, they discover a terrifying threat: a fissure in the surface of the world, so deep and wide that no one can perceive its limits. As the habitable zone continues to move, the migration will soon be blocked by this unbridgeable void, and the expedition has only one option to save its city from annihilation: descend into the unknown.<br />", "pubdate": "2017-07-11T00:00:00+00:00", "cover": "/calibre/get/cover/191/config", "languages": ["eng"], "authors": ["Greg Egan"], "publisher": "Night Shade Books", "user_metadata": {}, "rating": 3.5, "author_sort_map": {"Greg Egan": "Egan, Greg"}, "series": null, "title": "Dichronauts", "last_modified": "2021-05-12T14:21:57.390136+00:00", "timestamp": "2020-08-20T08:18:39+00:00", "author_link_map": {"Greg Egan": ""}, "user_categories": {}, "application_id": 191, "tags": [], "series_index": null, "format_metadata": {"azw3": {"path": "/config/Isaac Asimov/Dichronauts (191)/Dichronauts - Isaac Asimov.azw3", "size": 479036, "mtime": "2020-08-20T08:18:56.478776+00:00"}, "epub": {"path": "/config/Isaac Asimov/Dichronauts (191)/Dichronauts - Isaac Asimov.epub", "size": 381443, "mtime": "2020-08-20T08:18:41.399872+00:00"}, "mobi": {"path": "/config/Isaac Asimov/Dichronauts (191)/Dichronauts - Isaac Asimov.mobi", "size": 461780, "mtime": "2020-08-20T08:19:00.714468+00:00"}}, "formats": ["azw3", "epub", "mobi"], "main_format": {"mobi": "/calibre/get/mobi/191/config"}, "other_formats": {"azw3": "/calibre/get/azw3/191/config", "epub": "/calibre/get/epub/191/config"}, "category_urls": {"languages": {}, "authors": {"Greg Egan": "/calibre/ajax/books_in/617574686f7273/33/config"}, "publisher": {"Night Shade Books": "/calibre/ajax/books_in/7075626c6973686572/3832/config"}, "series": {}, "tags": {}}}
If you scroll over to the right you can see that for example the epub path is still listed as:
Code:
/config/Isaac Asimov/Dichronauts (191)/Dichronauts - Isaac Asimov.epub
I would have expected the API to return the updated path in the Greg Egan folder.

I'm using calibre 5.17. Is this a bug? Is there something I can do to work around it to get an updated path after calibre has moved the file?

Thanks!
ta264 is offline   Reply With Quote