API¶
flix.provider¶
Module provider provides the core logic behind providers.
- class flix.provider.ProviderResult[source]¶
The ProviderResult is the only type allowed to be returned by
Provider.search()
,Provider.search_movie()
andProvider.search_episode()
methods.- Parameters:
label (str, optional) – The result label.
label2 (str, optional) – The result label2.
icon (str, optional) – The result icon. If not set, the fallback icon will be used.
url (str, optional) – The result url. If not set, then provider_data must be set, otherwise the result is discarded.
provider_data (any, optional) – Data to be sent to provider when
Provider.resolve()
is called.
Example:
# Start by creating the result with some values result = ProviderResult( label="label", label2="label2", icon="foo/icon.png", url="http://foo.bar/video.mp4", ) # We can then modify values result.set_label2("new label2")
- class flix.provider.Provider[source]¶
This is where all the logic behind a provider must be implemented. It has methods which are required to be implemented by it’s subclass (
search()
,search_movie()
andsearch_episode()
) and also optional methods (resolve()
). The provider can then be registered by usingregister()
.Example:
class CustomProvider(Provider): def search(self, query): # Implementation here return [] def search_movie(self, tmdb_id, title, titles, year=None): return self.search("{:s} {:d}".format(title, year) if year else title) def search_show(self, tmdb_id, show_title, titles, year=None): return self.search("{:s} {:d}".format(show_title, year) if year else show_title) def search_season(self, tmdb_id, show_title, season_number, titles): return self.search("{:s} S{:02d}".format(show_title, season_number)) def search_episode(self, tmdb_id, show_title, season_number, episode_number, titles): return self.search("{:s} S{:02d}E{:02d}".format(show_title, season_number, episode_number)) CustomProvider().register()
flix.kodi¶
Module kodi provides Kodi utilities.
- flix.kodi.ADDON¶
The addon instance (
xbmcaddon.Addon
).
- flix.kodi.set_setting(id, value)¶
Set a setting.
- flix.kodi.get_setting(id)¶
Get a setting.
- Parameters:
id (str) – id of the setting that the module needs to access.
- flix.kodi.open_settings()¶
Open settings window.
- flix.kodi.translate(id)¶
Get a localized string.
flix.utils¶
Module utils provides some compatibility utilities for both Python 2 and 3.