Resolver¶
This module is used for the creation of “Route callbacks”.
-
class
codequick.resolver.
Resolver
[source]¶ This class is used to create “Resolver” callbacks. Resolver callbacks are callbacks that return playable video URL’s which Kodi can play.
Resolver inherits all methods and attributes from
script.Script
.- The possible return types from Resolver Callbacks are.
str
: URL as type “str”.iterable
: “List” or “tuple”, consisting of URL’s, “listItem’s” or a “tuple” consisting of (title, URL).dict
: “Dictionary” consisting of “title” as the key and the URL as the value.listItem
: Acodequick.Listitem
object with required data already set e.g. “label” and “path”.generator
: A Python “generator” that return’s one or more URL’s.False
: This will cause the “resolver call” to quit silently, without raising a RuntimeError.
Note
If multiple URL’s are given, a playlist will be automaticly created.
Raises: - RuntimeError – If no content was returned from callback.
- ValueError – If returned url is invalid.
Example: >>> from codequick import Resolver, Route, Listitem >>> >>> @Route.register >>> def root(_): >>> yield Listitem.from_dict("Play video", play_video, >>> params={"url": "https://www.youtube.com/watch?v=RZuVTOk6ePM"}) >>> >>> @Resolver.register >>> def play_video(plugin, url): >>> # Extract a playable video url using youtubeDL >>> return plugin.extract_source(url)
-
extract_source
(url, quality=None, **params)[source]¶ Extract video URL using “YouTube.DL”.
YouTube.DL provides access to hundreds of sites.
See also
The list of supported sites can be found at:
- Quality options are.
- 0 = SD,
- 1 = 720p,
- 2 = 1080p,
- 3 = Highest Available
Parameters: Returns: The playable video url
Return type: See also
The list of available parameters can be found at.