![]() |
#1 |
Member
![]() Posts: 14
Karma: 10
Join Date: Jan 2012
Device: Kindle
|
![]()
Hello,
please, is there any attribute of gui.current_db object to enumerate and work with custom columns? Or what is proper way to use custom columns? Thanx a lot. |
![]() |
![]() |
![]() |
#2 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,374
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
It is very hard to answer you without more information about what you want to do with them.
To directly answer the question, use gui.db.custom_field_keys(include_composites=True) to get a list of keys (lookup names) of the custom columns in the current library. There are many methods in gui.db.new_api (db/cache.py) to manipulate fields. Custom columns are just another example of fields. |
![]() |
![]() |
Advert | |
|
![]() |
#3 | |
Member
![]() Posts: 14
Karma: 10
Join Date: Jan 2012
Device: Kindle
|
Quote:
I will place maybe more general question, is there updated list/documentation of all methods usable in calibre plugin programming or I have to go through the cache.py as suggested? ![]() |
|
![]() |
![]() |
![]() |
#4 |
creator of calibre
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 45,258
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
|
![]() |
![]() |
![]() |
#5 | |
Member
![]() Posts: 14
Karma: 10
Join Date: Jan 2012
Device: Kindle
|
Quote:
![]() |
|
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,374
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
You should look at library/field_metadata.py. It explains what field (column) datatypes are available and has lots of methods for manipulating this information. You can get a field_metadata dict using something like fm = gui.db.field_metadata
|
![]() |
![]() |
![]() |
#7 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
@mirikbb: You can read the manual, look at calibre source, or do what I do: find a plugin that does what I need and "borrow" some code. I recommend just about any of kiwidude's plugins. And as you are after custom columns, then Count Pages is probably the one.
|
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
View list of custom column settings? | BookJunkieLI | Calibre | 8 | 07-25-2014 09:36 AM |
Custom Column Colors for "Text but with a fixed list of permitted values" | Skeeve | Calibre | 5 | 04-03-2014 01:44 PM |
Custom column returns value based on value of another custom column? | calvin-c | Calibre | 3 | 09-14-2013 02:24 PM |
Custom yes/no column built from long text column | Philantrop | Library Management | 7 | 03-23-2013 07:44 PM |
Custom Column with list of permitted values | Eugenie | Library Management | 1 | 01-10-2012 03:57 AM |