Skip to content

Commit 12ebf28

Browse files
author
Roman Miroshnychenko (Work)
committed
Updates code according to Kodi Jarvis API
1 parent 69f7c3d commit 12ebf28

2 files changed

Lines changed: 18 additions & 16 deletions

File tree

addon.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<addon id="plugin.video.example"
3-
version="1.2.0"
3+
version="2.0.0"
44
name="Example Kodi Video Plugin"
55
provider-name="Roman_V_M">
66
<requires>
7-
<import addon="xbmc.python" version="2.14.0"/>
7+
<import addon="xbmc.python" version="2.24.0"/>
88
</requires>
99
<extension point="xbmc.python.pluginsource" library="main.py">
1010
<provides>video</provides>

main.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ def get_categories():
6565
Here you can insert some parsing code that retrieves
6666
the list of video categories (e.g. 'Movies', 'TV-shows', 'Documentaries' etc.)
6767
from some site or server.
68+
6869
:return: list
6970
"""
7071
return VIDEOS.keys()
@@ -75,6 +76,7 @@ def get_videos(category):
7576
Get the list of videofiles/streams.
7677
Here you can insert some parsing code that retrieves
7778
the list of videostreams in a given category from some site or server.
79+
7880
:param category: str
7981
:return: list
8082
"""
@@ -84,7 +86,6 @@ def get_videos(category):
8486
def list_categories():
8587
"""
8688
Create the list of video categories in the Kodi interface.
87-
:return: None
8889
"""
8990
# Get video categories
9091
categories = get_categories()
@@ -94,9 +95,12 @@ def list_categories():
9495
for category in categories:
9596
# Create a list item with a text label and a thumbnail image.
9697
list_item = xbmcgui.ListItem(label=category, thumbnailImage=VIDEOS[category][0]['thumb'])
97-
# Set a fanart image for the list item.
98-
# Here we use the same image as the thumbnail for simplicity's sake.
99-
list_item.setProperty('fanart_image', VIDEOS[category][0]['thumb'])
98+
# Set graphics (thumbnail, fanart, banner, poster, landscape etc.) for the list item.
99+
# Here we use the same image for all items for simplicity's sake.
100+
# In a real-life plugin you need to set each image accordingly.
101+
list_item.setArt({'thumb': VIDEOS[category][0]['thumb'],
102+
'icon': VIDEOS[category][0]['thumb'],
103+
'fanart': VIDEOS[category][0]['thumb']})
100104
# Set additional info for the list item.
101105
# Here we use a category name for both properties for for simplicity's sake.
102106
# setInfo allows to set various information for an item.
@@ -123,8 +127,8 @@ def list_categories():
123127
def list_videos(category):
124128
"""
125129
Create the list of playable videos in the Kodi interface.
130+
126131
:param category: str
127-
:return: None
128132
"""
129133
# Get the list of videos in the category.
130134
videos = get_videos(category)
@@ -133,15 +137,13 @@ def list_videos(category):
133137
# Iterate through videos.
134138
for video in videos:
135139
# Create a list item with a text label and a thumbnail image.
136-
list_item = xbmcgui.ListItem(label=video['name'], thumbnailImage=video['thumb'])
137-
# Set a fanart image for the list item.
138-
# Here we use the same image as the thumbnail for simplicity's sake.
139-
list_item.setProperty('fanart_image', video['thumb'])
140+
list_item = xbmcgui.ListItem(label=video['name'])
140141
# Set additional info for the list item.
141142
list_item.setInfo('video', {'title': video['name'], 'genre': video['genre']})
142-
# Set additional graphics (banner, poster, landscape etc.) for the list item.
143-
# Again, here we use the same image as the thumbnail for simplicity's sake.
144-
list_item.setArt({'landscape': video['thumb']})
143+
# Set graphics (thumbnail, fanart, banner, poster, landscape etc.) for the list item.
144+
# Here we use the same image for all items for simplicity's sake.
145+
# In a real-life plugin you need to set each image accordingly.
146+
list_item.setArt({'thumb': video['thumb'], 'icon': video['thumb'], 'fanart': video['thumb']})
145147
# Set 'IsPlayable' property to 'true'.
146148
# This is mandatory for playable items!
147149
list_item.setProperty('IsPlayable', 'true')
@@ -166,8 +168,8 @@ def list_videos(category):
166168
def play_video(path):
167169
"""
168170
Play a video by the provided path.
171+
169172
:param path: str
170-
:return: None
171173
"""
172174
# Create a playable item with a path to play.
173175
play_item = xbmcgui.ListItem(path=path)
@@ -179,8 +181,8 @@ def router(paramstring):
179181
"""
180182
Router function that calls other functions
181183
depending on the provided paramstring
184+
182185
:param paramstring:
183-
:return:
184186
"""
185187
# Parse a URL-encoded paramstring to the dictionary of
186188
# {<parameter>: <value>} elements

0 commit comments

Comments
 (0)