Kodi Community Forum

Full Version: Python metadata scrapper
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Just wondering if the is documentation on how the Python metadata scrapers work. Mostly after I scrape and build the item with Kodi supported metadata is there a pythonic way I can insert it into Kodi library?
We need more docs on what is needed to make this work. I got it to scan and attempt to load the directory, but...nothing added.

You can look at the code on GitHub and reuse what you please. I don't mind if you use any of the code there, including the helpers I've written. The kodi_models file is quite useful.

Issue 306 of Nakamori has updates on the headaches and bugs we've encountered.

EDIT: BTW it's called a scraper, not a scrapper. I don't know why, but so many people mix that up. A scrapper would turn garbage into something more useful. A scraper takes data from somewhere and uses it in a different format.
I got it working! Check the GitHub link. I'll clean it up a bit and push.

EDIT: Specifically, look at the functions in plugin.video.nakamori/nakamoriplugin.py that start with `scrape`, as well as script.module.nakamori-lib/lib/shoko_models/v2.py for the methods get_listitem() and get_infolabels(). Series and Episode are the relevant classes for the Metadata agent.
(2019-04-05, 23:34)smitchell6879 Wrote: [ -> ]Just wondering if the is documentation on how the Python metadata scrapers work.

since there isn't any documentation yet, the easiest way to start is to check the code of the example scrapers:
metadata.demo.albums
metadata.demo.artists
metadata.demo.movies
metadata.demo.tv

i've written a python album and artist scraper:
metadata.integral.artists
metadata.integral.albums

and phate89 has written a movie and tvshow scraper:
metadata.themoviedb.org
metadata.tvdb.com
 
(2019-04-05, 23:34)smitchell6879 Wrote: [ -> ]Mostly after I scrape and build the item with Kodi supported metadata is there a pythonic way I can insert it into Kodi library?

the answer hasn't changed since the last time you asked... no, scrapers can not add items to the library themselves.
(2019-04-07, 01:54)ronie Wrote: [ -> ] 
the answer hasn't changed since the last time you asked... no, scrapers can not add items to the library themselves.

Haha Thanks I will look at the example you provided thanks
Ronie, not sure if you missed it, but the answer you gave is now incorrect.
https://github.com/xbmc/xbmc/pull/13566
Starting there, addons can add items to the library. 18.2 will have support for it.
(2019-04-07, 03:00)da3dsoul Wrote: [ -> ]Ronie, not sure if you missed it, but the answer you gave is now incorrect.
https://github.com/xbmc/xbmc/pull/13566
Starting there, addons can add items to the library. 18.2 will have support for it.

'addons' is a bit of a generic term ;-)
my comments are related to metadata scraper addons, the ones that use the "xbmc.metadata.scraper.*" extension point.
That is fair. We now have Metadata Plugins, which explicitly add new items to the library from a plugin path, as well as Metadata Scraper Addons, which can't add items, but instead fetch info for existing items.