Mobileread
[Metadata Source Plugin] Questions regarding parse select, docs and ref templates
#1  Boilerplate4U 07-06-2020, 08:03 AM
Hi all!

Some questions regarding the metadata plugin:

1. Are there any architecture docs for metadata plugin that describes the overall functionality of worker.py in more detail?

2. Is there any similar built in functionally the resembles of the BeautifulSoup selector ("Soup.select") in the example below:

Code
Html = requests.get(URL)
Soup = BeautifulSoup(Html)
Elements = Soup.select("#main > product-grid > li:nth-child(1) > article > a")[0]
Href = Elements[0].get('href')
3. Is there a good reference template for the metadata plugin?
--

Any suggestions are welcome, thanks in advance!
Reply 

#2  kovidgoyal 07-06-2020, 09:16 AM
1. worker.py is irrelevant, all you need to do is subclass https://manual.calibre-ebook.com/plugins.html#module-calibre.ebooks.metadata.sources.base and implement identify() and download_cover() methods.

2. beautifulSoup is available in calibre. from calibre.ebooks.beautifulsoup import BeautifulSoup

3. Look at any of th eexisting metadata download plugin
Reply 

#3  Boilerplate4U 07-06-2020, 09:35 AM
Kovidgoyal, thanks for the prompt reply!

Regarding plugin template, I'd really appreciate if you could recommend some clean implementations since the plugins I've seen so far were a bit to much spaghetti :-)

Btw, are there any simple step by step guides regarding develop, test and deploy?
Reply 

#4  kovidgoyal 07-06-2020, 10:06 AM
Look for the builtin plugins google and google images are both fairly short and simple. As for how to develop and test, use calibre-customize to develop, see calibre-customize --help and for testing again look at the builtin plugins, near the bottom.
Reply 

#5  Boilerplate4U 07-06-2020, 10:26 AM
These?

https://github.com/kovidgoyal/calibre/blob/master/src/calibre/ebooks/metadata/sources/google_images.py
https://github.com/kovidgoyal/calibre/blob/master/src/calibre/ebooks/metadata/sources/google.py
Reply 

#6  Boilerplate4U 07-06-2020, 10:30 AM
When are you supposed to use "class Worker (Thread)" (in worker.py) to implement a metadata plugin?

PS...
If possible, please move this thread to the correct forum: "E-Book Software > Calibre > Plugins"
Reply 

#7  kovidgoyal 07-06-2020, 10:37 AM
Never. Again worker.py is irrelevant.
Reply 

#8  Boilerplate4U 07-06-2020, 11:04 AM
Quote kovidgoyal
Never. Again worker.py is irrelevant.
Ok. I'm a bit curious as to why almost all metadata-source-plugins that I have looked at so far, utilize the following basic structure (some kind of old methodology or auto generated?)
Code
__init__.py
changelog.txt
worker.py
config.py
Plug-import-name goodreads.txt
Reply 

#9  Boilerplate4U 07-06-2020, 11:20 AM
Just some examples: Mondourania, Goodreads, Skoob Books, Moly_hu, Adlibris, Barnes & Noble, KoboBooks ...
Reply 

#10  kovidgoyal 07-06-2020, 12:13 PM
Probably because they copy each other. You just need to implement those two methods, thats all. What other files you use is entirely up to you.
Reply 

  Next »  Last »  (1/2)
Today's Posts | Search this Thread | Login | Register