Register Guidelines E-Books Search Today's Posts Mark Forums Read

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

Notices

Reply
 
Thread Tools Search this Thread
Old 06-11-2019, 01:59 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
Write to a custom column from a Metadata Source Plugin

Hi, everyone.

Is it possible for a Metadata Source Plugin to write data to a custom column?
I wish I could write the book pages to such a column, defined by the user.

If possible, how should I proceed?

Thanks!
thiago.eec is offline   Reply With Quote
Old 06-11-2019, 07:56 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,839
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
No, metadata source plugins do not have this capability.
kovidgoyal is offline   Reply With Quote
Advert
Old 06-11-2019, 08:18 PM   #3
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 29,773
Karma: 54401244
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Would the Import List plugin do this (customized template) from a saved file?
theducks is online now   Reply With Quote
Old 06-11-2019, 11:19 PM   #4
BetterRed
null operator (he/him)
BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.BetterRed ought to be getting tired of karma fortunes by now.
 
Posts: 20,544
Karma: 26954694
Join Date: Mar 2012
Location: Sydney Australia
Device: none
Quote:
Originally Posted by thiago.eec View Post
Hi, everyone.

Is it possible for a Metadata Source Plugin to write data to a custom column?
I wish I could write the book pages to such a column, defined by the user.

If possible, how should I proceed?

Thanks!
compurandom did it by providing both a Metadata Data Source and a GUI plugin for Wikidata - I think the GUI PI uses the value the MDS PI puts into the Identifiers column - that's as much as I know.

BR
BetterRed is offline   Reply With Quote
Old 06-12-2019, 04:45 PM   #5
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 for the suggestion. I don't want to create another plugin just for that. I'll let the number of pages on the log, in case someone want to check.

Thanks!
thiago.eec is offline   Reply With Quote
Advert
Old 06-13-2019, 08:18 AM   #6
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
@thiago.eec: If you are interested in getting the page count from a site, the Count Pages plugin supports this. The current sites supported use an XPath statement to find the page count. This plus the URL template and some names are all that are needed.
davidfor is offline   Reply With Quote
Old 06-13-2019, 05:00 PM   #7
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
Quote:
Originally Posted by davidfor View Post
@thiago.eec: If you are interested in getting the page count from a site, the Count Pages plugin supports this. The current sites supported use an XPath statement to find the page count. This plus the URL template and some names are all that are needed.
Hi, @davidfor.
I use the Count Pages plugin all the time. Nice tool.
Would it be possible to add skoob.com.br to the list?
I can provide you any information you need.

Book URL Template: https://www.skoob.com.br/livro/{skoob_id}

XPath* to pages count:

Code:
info_nodes = root.xpath('//div[@class="sidebar-desc"]/text()')
for info in info_nodes:
pages = re.search('(Páginas: )([0-9]+)', info).groups(0)[1]

* There are a lot of info on a single DIV. This is how I managed to extract each info. I'm sure you can find a better way. Take a look at the DIV:

Code:
<div class="sidebar-desc">

                ISBN-13: <span>9788528610390</span><br>ISBN-10: <span>852861039X</span><br>

        Ano: 2003          / Páginas: 224<br>        Idioma: português  <br>        Editora: <a href="/editora/1-bertrand-brasil">Bertrand Brasil</a><br>    </div>

Last edited by thiago.eec; 06-13-2019 at 05:35 PM.
thiago.eec is offline   Reply With Quote
Old 06-18-2019, 08:12 AM   #8
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
Quote:
Originally Posted by davidfor View Post
@thiago.eec: If you are interested in getting the page count from a site, the Count Pages plugin supports this. The current sites supported use an XPath statement to find the page count. This plus the URL template and some names are all that are needed.
I modified my version of Count Pages to include Skoob. Just hope I didn't break anything. So far so good .
Attached Files
File Type: zip Count Pages.zip (290.9 KB, 246 views)
thiago.eec is offline   Reply With Quote
Old 06-18-2019, 10:14 AM   #9
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
I did have a look at this on the weekend. I was trying to work out a good way to handle the need for the regex. I have an idea, but probably won't have a chance to look at it until next week. If it doesn't work, your solution is simple and will work.
davidfor is offline   Reply With Quote
Old 06-18-2019, 10:53 AM   #10
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
Quote:
Originally Posted by davidfor View Post
I did have a look at this on the weekend. I was trying to work out a good way to handle the need for the regex. I have an idea, but probably won't have a chance to look at it until next week. If it doesn't work, your solution is simple and will work.
Good to know! If you have another solution without regex, I'll use it on Skoob Books plugin either, since I use regex for other cases like this.
thiago.eec is offline   Reply With Quote
Old 06-19-2019, 02:37 AM   #11
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by thiago.eec View Post
Good to know! If you have another solution without regex, I'll use it on Skoob Books plugin either, since I use regex for other cases like this.
I was looking for one without regex, but couldn't find it. What I was planning was to add the regex in the site configuration. And then run it on the XPath result. Not really much different from yours, but, it means all the changes to add a new site are in one place.
davidfor is offline   Reply With Quote
Old 07-13-2019, 09:57 AM   #12
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,907
Karma: 47303748
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
I have just released a beta of the Count Pages plugin that adds Skoob as page count source site. I have added a, hopefully, generic way to handle the need for a regex on the result of the XPath used to find the page count. I haven't done much testing, but it seems to work for the few books I have added from the site. It is at the end of the Count Pages thread.
davidfor is offline   Reply With Quote
Old 07-13-2019, 04:13 PM   #13
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
Thank you very much, @davidfor!
thiago.eec is offline   Reply With Quote
Reply

Tags
custom column, metadata source, plugin

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[Metadata Source Plugin] Moly.hu kloon Plugins 72 11-03-2023 11:28 AM
How to write a Metadata plugin modnar_wylde Plugins 4 11-25-2018 08:38 PM
Add Read/Unread metadata from custom column to metadata jacket allanahk Library Management 4 11-12-2018 03:10 PM
Plugin or custom column to show GB size of book mom34spartan Plugins 5 07-08-2013 09:07 AM
Write custom column from Python nsomlai Calibre 7 11-02-2010 11:12 AM


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


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