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
Zealot
thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.
 
Posts: 116
Karma: 71600
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: 34,550
Karma: 11409410
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
No, metadata source plugins do not have this capability.
kovidgoyal is offline   Reply With Quote
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: 23,276
Karma: 24326584
Join Date: Aug 2009
Location: (The original) Silicon Valley, USA
Device: K4NT, Galaxy Tab A, Kobo Aura2
Would the Import List plugin do this (customized template) from a saved file?
theducks is offline   Reply With Quote
Old 06-11-2019, 11:19 PM   #4
BetterRed
null operator
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: 13,643
Karma: 10793754
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 online now   Reply With Quote
Old 06-12-2019, 04:45 PM   #5
thiago.eec
Zealot
thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.
 
Posts: 116
Karma: 71600
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
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: 16,960
Karma: 26390450
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo,Aura H2O,Glo HD,Aura ONE,Clara HD,Forma;tolino epos
@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
Zealot
thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.
 
Posts: 116
Karma: 71600
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
Zealot
thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.
 
Posts: 116
Karma: 71600
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, 24 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: 16,960
Karma: 26390450
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo,Aura H2O,Glo HD,Aura ONE,Clara HD,Forma;tolino epos
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
Zealot
thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.
 
Posts: 116
Karma: 71600
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: 16,960
Karma: 26390450
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo,Aura H2O,Glo HD,Aura ONE,Clara HD,Forma;tolino epos
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: 16,960
Karma: 26390450
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo,Aura H2O,Glo HD,Aura ONE,Clara HD,Forma;tolino epos
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
Zealot
thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.thiago.eec knows who John Galt is.
 
Posts: 116
Karma: 71600
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 14 04-11-2019 01:20 PM
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 03:22 AM.


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