v18 Python scrapers no access to path-specific settings
#1
I've started working on a Python scraper, and I've come upon a problem (ohh I wish I had started this earlier).

The Python scrapers run as plugins, by passing just a "plugin://" path through "CDirectory::GetDirectory" and "CPluginDirectory::GetPluginResult", so it loses the path-specific settings attached to the individual CScraper instance.

The clearest example I have for path-specific settings is for TV shows: the main source path can be configured for aired-date episode order that applies to most shows, and just a few specific TV shows can be configured to use DVD or "intended" order, when that differs from the aired order (Firefly for instance).

I've come up with a possible solution, but it's awful: pass along the settings XML (from "CScraper::GetPathSettings") as another path parameter, then the Python scraper will have to parse it themselves rather than using the existing xbmcaddon.Addon().getSetting(setting_name) or xbmcplugin.getSetting(handle, setting_name) methods. Scraper master @spiff, do you have any thoughts on this, do you see a good solution that won't be too disruptive here in the RC phase? If I had caught this earlier I would look into setting it up so that path-specific settings can be pulled from xbmcplugin.getSetting(handle, setting_name), but that's a bigger change that I don't feel comfortable making in RC.
Reply
#2
yeah, that's something i had avoided addressing before somebody actually noticed it Wink

even if it's bigger surgery i think we should do it properly immediately. if not we have to drag the backwards compat for the temporary solution with us for a long long time.
my idea was to add a dedicated callback class for a scraper to avoid murking up the waters for GetSettings, but i'm open for other ideas of course.
Reply
#3
A separate callback class does sound like a good idea.

And I seem to be half-way around the world from everyone. That may get frustrating.
Reply
#4
Maybe pass all necessary options explicitly via URL query string? E.g. plugin://metadata.tvdb/?order=dvd&rating=imdb&language=English
Reply
#5
@Roman_V_M That would at least put an abstraction in here, but still doesn't feel like an ideal solution for the long term. There are already other query params that are passed along, so the settings would need something to set them apart to avoid collisions, like prefixing with "path.".

I figure this interface will still need to go through some big changes (spiff, as you noted in the intial PR "this is far from optimal"), so I don't think we should worry about keeping backward compat for very long, instead early Python scrapers will need to keep up with core changes. Not forever like skins, but for a little while so we can hope to build an ideal interface at some point in the future, because "ideal" is hard to really define from where we are now.
Reply
#6
Could you perhaps bundle all the settings into a single parameter, like plugin://metadata.tvdb/?settings={"order":"dvd","rating":"imdb","language":"English"}?
Reply
#7
Can it be addressed in the near future?
Reply

Logout Mark Read Team Forum Stats Members Help
Python scrapers no access to path-specific settings0