Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Development

Notices

Reply
 
Thread Tools Search this Thread
Old Yesterday, 05:13 AM   #1
yamusing
Enthusiast
yamusing began at the beginning.
 
Posts: 49
Karma: 10
Join Date: Jul 2019
Device: none
metadata plugin how to set custom fields

I'm trying to make my own personal metadata plugin but I'm not able to find out how to set a custom column value. I can do Metadata.authors and Metadata.tags etc.. but not metadata_info.set_user_metadata("#testColumn", "testvalue"). Any ideas how I can achive this without dipping into the db?

Code:
    def identify(self, log, result_queue, abort, title=None, authors=None, identifiers={}, timeout=30):
        log(f"Searching for metadata: {title}")

        metadata_info = Metadata("test123")
        metadata_info.authors = ["Unknown Author", "Another Author"]
        metadata_info.tags = ['Example', 'Calibre']
        metadata_info.comments = 'This is a test.'
        metadata_info.set_user_metadata('#testColumn', "testvalue")
        
        result_queue.put(metadata_info)
yamusing is offline   Reply With Quote
Old Yesterday, 06:55 AM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,423
Karma: 27757236
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
IIRC metadata plugins dont support setting custom metadata. This is because they have to work with arbitrary libraries and so dont depend on non-builtin columns.
kovidgoyal is offline   Reply With Quote
Old Yesterday, 08:09 AM   #3
yamusing
Enthusiast
yamusing began at the beginning.
 
Posts: 49
Karma: 10
Join Date: Jul 2019
Device: none
Quote:
Originally Posted by kovidgoyal View Post
IIRC metadata plugins dont support setting custom metadata. This is because they have to work with arbitrary libraries and so dont depend on non-builtin columns.
ah ok, guess db is the only way then. I have a script that takes the book ids and puts in the metadata in those custom fields using the db, but everytime I do this calibre needs a restart to reflect those changes on the interface
yamusing is offline   Reply With Quote
Old Yesterday, 10:31 AM   #4
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,465
Karma: 8025600
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by yamusing View Post
ah ok, guess db is the only way then. I have a script that takes the book ids and puts in the metadata in those custom fields using the db, but everytime I do this calibre needs a restart to reflect those changes on the interface
You can do this with a User Interface plugin, an Action Chains python action, or a calibre python template.
chaley is offline   Reply With Quote
Reply

Tags
plugin, python


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Metadata plugini set custom fields Luftzug Development 6 05-04-2024 10:00 PM
Calibre's Basic metadata with custom metadata fields MichaelSarri Calibre 2 04-15-2020 03:59 AM
Adding custom metadata fields sutzig Library Management 5 03-20-2019 08:52 PM
Read custom fields from metadata plugin Manitu80 Development 3 10-26-2016 10:59 PM
Access custom fields from metadata DB JupiterJones Development 2 10-22-2014 07:48 AM


All times are GMT -4. The time now is 07:09 PM.


MobileRead.com is a privately owned, operated and funded community.