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 08-25-2019, 06:47 PM   #1
thiago.eec
Guru
thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.
 
Posts: 921
Karma: 1177583
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite
Set a value to a custom column inside a plugin

Hi everyone.

I'm trying to set a value to a custom column, but got stuck.

Here is what I got:

Code:
mi = db.get_metadata(book_id)
mi.set_user_metadata(#percentage, progress)
But it doesn't work, because 'progress' just a integer.
According to the Manual, I should use:

Code:
set_user_metadata(field, metadata)
How is a 'metadata' represented? I've noticed is not just a value, but I can't figure out how to make it work.
thiago.eec is offline   Reply With Quote
Old 08-25-2019, 11:21 PM   #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: 43,842
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Assuming percentage is a numeric field it should be fine. But if what youwant to do is set it in the custom column in the database, the way to do it is like this:

db.new_api.set_field('#percentage', {book_id: value})
kovidgoyal is online now   Reply With Quote
Advert
Old 08-27-2019, 05:48 PM   #3
thiago.eec
Guru
thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.thiago.eec ought to be getting tired of karma fortunes by now.
 
Posts: 921
Karma: 1177583
Join Date: Dec 2016
Location: Goiânia - Brazil
Device: iPad, Kindle Paperwhite
Thanks, Kovid.

That worked.
thiago.eec is offline   Reply With Quote
Reply

Tags
custom columns, metadata


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to set value of custom column automatically? steins Plugins 5 12-27-2018 03:23 AM
Set default value of a custom column laszlopanaflex Library Management 2 12-01-2018 02:54 PM
How to set the number of decimals in a custom column sekhemty Library Management 3 04-28-2017 09:06 AM
Set Custom Column from identify.py ahisham Development 6 02-05-2015 09:53 AM
Using OnDevice to set the value of a custom column WendyR14 Library Management 3 10-23-2011 08:03 PM


All times are GMT -4. The time now is 05:45 AM.


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