![]() |
#1 |
Calibre Plugins Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 4,671
Karma: 2162246
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
|
Bulk updating metadata from a plugin?
Hi - I'm looking at some (ancient) code in the Extract ISBN plugin.
The code just wants to update a batch of books to set the .isbn property of the Metadata. For reasons I have long since got no idea on (likely written 12+ years ago), the code appears to steal some behaviour from the Edit Metadata plugin back then. It currently looks like this: Code:
# At this point we want to re-use code in edit_metadata to go ahead and # apply the changes. So we will replace the Metadata objects with some # empty ones with only the isbn field set so only that field gets updated id_map = {} for i, title, last_modified, isbn in extracted_ids: mi = Metadata(_('Unknown')) mi.isbn = isbn id_map[i] = mi edit_metadata_action = self.gui.iactions['Edit Metadata'] edit_metadata_action.apply_metadata_changes(id_map, callback=self._mark_and_display_results) It is entirely possibly that in "current" calibre this is a terrible approach and there is a better way of doing this. Thoughts/suggestions welcomed - it still seems to work perfectly fine for me but two users now are saying their titles are being reset to "unknown". I havent touched any of this code, the only change my latest plugin release made is to increase the likelihood of an ISBN being found (which would then invoke this code)... Last edited by kiwidude; Today at 06:20 AM. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
[Editor Plugin] Bulk Image Resizer Plugin | eliteart | Plugins | 9 | 04-26-2024 06:58 AM |
Updating plugin fails because plugin file is in use by Calibre? | ownedbycats | Calibre | 1 | 12-03-2022 08:34 PM |
Metadata Download Plugin - Bulk Downloads | Bradles | Development | 2 | 03-14-2021 10:23 PM |
Advice on Bulk Updating MetaData | tonyd52 | Library Management | 2 | 06-06-2011 01:06 PM |
Updating Metadata in Bulk | Turt99 | Calibre | 5 | 06-07-2010 03:19 PM |