|
|
Thread Tools | Search this Thread |
11-24-2023, 11:56 AM | #1 |
Junior Member
Posts: 4
Karma: 10
Join Date: Nov 2023
Device: Kindle
|
Auto registration of new custom columns from plugin code [question/feature request]]
Is it posiible to write a Calibre plugin that would automatically ask Calibre to create some new custom columns?
For example: i have some download metadata plugin "A". This plugin has a configuration option: Fetch number of ratings: true/false. If user enables this option i would like plugin "A" to automatically ask Calibre to create/register new custom column "number_of_ratings" if it does not exist already |
11-24-2023, 12:06 PM | #2 |
creator of calibre
Posts: 44,565
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
You can use the calibre database APIs to create custom columns in your plugin. But note that the new column will not be useable until calibre is restarted.
|
Advert | |
|
11-24-2023, 01:58 PM | #3 |
null operator (he/him)
Posts: 21,008
Karma: 27620706
Join Date: Mar 2012
Location: Sydney Australia
Device: none
|
Moderator Notice
Moved to Development BR |
11-24-2023, 05:51 PM | #4 |
Grand Sorcerer
Posts: 12,043
Karma: 7548549
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
See CreateNewCustomColumn in calibre.gui2.preferences.create_custom_column.py
Spoiler:
|
12-06-2023, 03:57 AM | #5 |
Junior Member
Posts: 4
Karma: 10
Join Date: Nov 2023
Device: Kindle
|
@chaley thanks, it's very helpful!
@kovidgoyal my humble suggestion is to add such a simple and more obvious mechanism to the official plugin API as part of "class calibre.customize.Plugin" for example as some property: custom_columns: list[Dict]. If defined then Calibre would auto create such columns during plugin installation/upgrade and do autorestart |
Advert | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Unable to metadata download plugin to custom columns. | cdecaf | Development | 1 | 09-21-2020 02:04 PM |
Auto populate custom columns on import. | EdShdBeInBed | Calibre | 1 | 02-06-2019 11:49 AM |
Auto Add - a feature request or suggestion | Weekendmedic | Library Management | 3 | 05-30-2014 10:49 AM |
Feature Request - Adjust Gutter Width Between Columns | Noventer | Marvin | 0 | 03-13-2014 08:13 PM |
Calibre feature request: Additional Columns/Fields | mornington | Calibre | 29 | 12-01-2010 07:15 AM |