python scrapers
#1
So I have been reading here in there Kodi is slowly moving toward python scrapers...

With that is there somewhere I can look or has someone already made a python based scraper?

I have a few extras things I would like to add to the library but the site only have a python API... Yes I could write it so that property are set like skin helper but if I could actually save the data it would save me internet usage and will save the site a few hits.
Reply
#2
it's still work in progress and subject to change

examples and pending changes to the implementation:
https://github.com/xbmc/xbmc/tree/master...emo.movies
https://github.com/xbmc/xbmc/pull/12661
https://github.com/xbmc/xbmc/pull/12857
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#3
Just taking a glance over the code I haven't had a chance to test anything yet... But to add a video or music file to the library l have to do is build a list item with the url and set property('original title') and add item to directory?

Or am missing something
That seem way too easy.
Reply
#4
that's the basics of of it. obviously there's an input side to it, and a few different operation modes but ultimately the scraper does add an item much like a plugin and sets props on that item.
Reply
#5
Well I guess what I am asking if I wanted to try my hand at writing a scraper and say I started by scraping say the .nfo files (something easy to start with). I can parse the .nfo get all the info out of the tags set them as variables... then is the next step like a plugin... just make a listitem set all the info, properties that I gathered to the listitem and item to directory then end directory. At what point does it actually get added to the library view in kodi... And how does kodi know which library to add it to?

I know this stuff is probably covered somewhere but the main tutorial is marked outdated and in my adventure of developing for kodi I would just like to get a better understanding of the different part so that oneday I may can combine them into something actually beneficial.

Basically I would like to make a generic python scrapper and test it so that I can understand how this work...
Reply
#6
it works exactly like the xml based scrapers, except we call the python script instead of invoking the xml/regex file. so you scan to library as normal, set content and all that jazz.
Reply
#7
Alirght so by setting content type will cause Kodi to add it into the correct library..?

I will have to give it a try over next coming weeks
Reply
#8
Alright so did a little testing tonight and I have successfully pull metadata from tmdb .. and can filter through it... All in python only problem is I still don't understand how to add this info into the correct Kodi DB..

I could do a SQL connect a write it directly ...at which point I might as well make my own DB.

So what is the secret to triggering Kodi to add a video to the library?
Reply
#9
again, as i said, it works *exactly* like the xml based scrapers. you set content, you choose the python based scraper, then you scan as normal. you don't touch the databases, that's the job of the kodi video scanner. see here https://kodi.wiki/view/Adding_video_sources
Reply
#10
Thanks I think I understand now.. one last question.. when I build the listitem.. if I add properties that are not supported in kodi's database will Kodi just ignore those properties or will the still be added and callable from the skin.

Example

Listitem.setinfo('reviews': string list of reviews)

Since Kodi doesn't have a listitem.reviews

Would be added to the database and callable from listitem.property(reviews)?
Reply
#11
it will be ignored.
Reply
#12
Thanks that's exactly what I needed to know. I appreciate you taking time to answer my questions.
Reply
 
Thread Rating:
  • 0 Vote(s) - 0 Average



Logout Mark Read Team Forum Stats Members Help
python scrapers00