Multiple scrapers in one addon?
#1
I have two scrapers defined in my addon.xml. Kodi correctly lists the addon for both tv shows and movies in information providers in add ons, but when I try to scrape tv shows, Kodi is always invoking movie_scraper.py rather than tvshow_scraper.py. Is this not possible or am I doing something wrong?

xml:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="metadata.foo.python" name="Foo Scraper"
       version="0.0.2" provider-name=“Author”>
    <requires>
        <import addon="xbmc.metadata" version="2.1.0"/>
        <import addon="xbmc.python" version="3.0.0"/>
        <import addon="script.module.requests" version="2.22.0"/>
    </requires>
    <extension point="xbmc.metadata.scraper.movies" language="en" library="movie_scraper.py"/>
    <extension point="xbmc.metadata.scraper.tvshows" language="en" library="tvshow_scraper.py"/>
    <extension point="xbmc.addon.metadata">
        <summary lang="en_GB">Fetch TV show and Movie metadata from a Foo server</summary>
        <summary lang="en_NZ">Fetch TV show and Movie metadata from a Foo server</summary>
        <summary lang="en_US">Fetch TV show and Movie metadata from a Foo server</summary>
        <description lang="en_GB">Fetch TV show and Movie metadata from a Foo server</description>
        <description lang="en_NZ">Fetch TV show and Movie metadata from a Foo server</description>
        <description lang="en_US">Fetch TV show and Movie metadata from a Foo server</description>
        <platform>all</platform>
        <license>GPL-3.0-or-later</license>
        <reuselanguageinvoker>false</reuselanguageinvoker>
    </extension>
</addon>
Reply
#2
I don't think you can have both a movie and tv show scraper in the same add-on.  When Kodi calls the addon, it is expecting one or the other, and I'm pretty sure some of the initial calls are the same for both types of videos, so there is no way for the add-on to know whether it's doing movies or TV shows.  You are probably going to have to separate the code into separate add-ons.
Reply
#3
I'm not following what you're saying. If Kodi calls the library as specified in addon.xml, the addon knows which type of file it is scraping. Since everything else in the UI works properly with this config, I'm suspecting this is a bug in Kodi.
Reply
#4
Kodi has been designed to use separate add-ons for scraping, thus I don't think Kodi has an internal "extension point" selection for your add-on in it. (I'm not a Kodi programmer, but just trying to rationalize its processes). Where would that selection parameter come up in Kodi for your add-on?

In other words, why, as per design, would this be a bug in Kodi when you have a problem with your own single 'all-in-one' add-on?
Reply
#5
(2023-01-04, 09:25)Klojum Wrote: Kodi has been designed to use separate add-ons for scraping
Kodi supports multiple <extension>'s in an addon (at least according to the wiki and posts on the forums), thus, it's consistent to assume what I'm trying to do works. Was kodi designed to use separate addons for scraping, or is that just how it's traditionally been done? If you're not a kodi programmer, how do you know it's the former and not the latter?
 
Quote:I don't think Kodi has an internal "extension point" selection for your add-on in it. Where would that selection parameter come up in Kodi for your add-on?
It's done when you select the scraper for the source. For example, my addon as defined above comes up as a valid scraper for both movie and tvshow content. As I noted in my original post, this part currently works as expected in Kodi. The only thing left for kodi to do is to call movie_scraper.py for movies and tvshow_scraper.py for tvshows as defined in addon.xml. It's this last part that currently doesn't work. Since everything else works, this seems like a bug.
Reply
#6
I feel like you're not going to take the correct answer, but I will try again.  You cannot have the same scraper doing TV shows and Movies.  When Kodi calls the scraper, it just calls it using the add-on name.  The extension point has nothing to do with the actual call.  The first time Kodi calls the scraper add-on, it's with a name to search.  There is no information of which I'm aware that tells you whether that is a movie or a TV show.  But feel free to keep trying.
Reply
#7
No offense, but it's not me who is not understanding the issue. Let's try another way:

In the addon.xml:

xml:

 
Code:
<extension point="xbmc.metadata.scraper.movies" language="en" library="movie_scraper.py"/>

So kodi should pass all of the movie library titles (one at a time) to movie_scraper.py.

Also in the addon.xml:

xml:

 
Code:
<extension point="xbmc.metadata.scraper.tvshows" language="en" library="tvshow_scraper.py"/>

So kodi should pass all of the tvshow library titles (one at a time) to tvshow_scraper.py.

According to addon.xml, kodi should pass movie titles to movie_scraper.py and tvshow titles to tvshow_scraper.py. Do you see now why it doesn't matter that only the title is passed? The issue I'm asking about is why kodi isn't calling the correct library as specified in addon.xml. Is there someone who actually knows how kodi determines the library to call that I can ask about this?
Reply
#8
You're telling me how you want it to be.  I'm telling you how it is.  I'm done.  Good luck.
Reply
#9
Use a fall through search if you want to handle both TV and Movies.

When addon gets called with title="TV.Title.S01E01.Episode.Name"

Addon queries Movies it knows about for "TV Title", gets 0 results, so then it can search TV Shows for "TV Title" which then will yield a result, you can parse result and match to S01

Also, the clue is in the Title, if title matches an expected parameter regex (S*E*) and we did not get a year for a movie it must be a TV Show.

Honestly it takes less than a second to fall through a search, rare occasion where result would be wrong then the end user can manually identify.

I tried some hacky ways around this but I don't find any other way to determine what Kodi is asking you to search for (movies or tvshow).

I did this very same thing with my Alexa integration, Alexa does not tell me it's looking for anything specific just asks for a title and expects me to figure it out.
Reply
#10
(2023-01-05, 13:00)pkscout Wrote: You're telling me how you want it to be.  I'm telling you how it is.  I'm done.  Good luck.

Confirmed bug. Will be fixed in v21 Omega.
Reply

Logout Mark Read Team Forum Stats Members Help
Multiple scrapers in one addon?0