Route¶
This module is used for the creation of “Route callbacks”.
-
class
codequick.route.
Route
[source]¶ This class is used to create “Route” callbacks. “Route” callbacks, are callbacks that return “listitems” which will show up as folders in Kodi.
Route inherits all methods and attributes from
codequick.Script
.- The possible return types from Route Callbacks are.
iterable
: “List” or “tuple”, consisting ofcodequick.listitem
objects.generator
: A Python “generator” that return’scodequick.listitem
objects.False
: This will cause the “plugin call” to quit silently, without raising a RuntimeError.
Raises: RuntimeError – If no content was returned from callback.
Example: >>> from codequick import Route, Listitem >>> >>> @Route.register >>> def root(_): >>> yield Listitem.from_dict("Extra videos", subfolder) >>> yield Listitem.from_dict("Play video", "http://www.example.com/video1.mkv") >>> >>> @Route.register >>> def subfolder(_): >>> yield Listitem.from_dict("Play extra video", "http://www.example.com/video2.mkv")
-
autosort
= True¶ Set to
False
to disable auto sortmethod selection.Note
If autosort is disabled and no sortmethods are given, then SORT_METHOD_UNSORTED will be set.
-
category
¶ Manualy specifiy the category for the current folder view. Equivalent to setting
xbmcplugin.setPluginCategory()
-
redirect_single_item
= False¶ When this attribute is set to
True
and there is only one folder listitem available in the folder view, then that listitem will be automaticly called for you.
-
update_listing
= False¶ When set to
True
, the current page of listitems will be updated, instead of creating a new page of listitems.
-
content_type
= None¶ The add-on’s “content type”.
If not given, then the “content type” is based on the “mediatype” infolabel of the listitems. If the “mediatype” infolabel” was not set, then it defaults to “files/videos”, based on type of content.
- “files” when listing folders.
- “videos” when listing videos.
See also
The full list of “content types” can be found at:
https://codedocs.xyz/xbmc/xbmc/group__python__xbmcplugin.html#gaa30572d1e5d9d589e1cd3bfc1e2318d6
-
add_sort_methods
(*methods, **kwargs)[source]¶ Add sorting method(s).
Any number of sort method’s can be given as multiple positional arguments. Normally this should not be needed, as sort method’s are auto detected.
You can pass an optional keyword only argument, ‘disable_autosort’ to disable auto sorting.
Parameters: methods (int) – One or more Kodi sort method’s. See also
The full list of sort methods can be found at.
https://codedocs.xyz/xbmc/xbmc/group__python__xbmcplugin.html#ga85b3bff796fd644fb28f87b136025f40