2016-02-10, 16:49
Hello guys,
Let's say my addon lists some streams and I focused one stream like in the following picture
My aim is now if I press the 'i' button to show video information of this item, to not show the video info of the selected item but instead
create a new listitem and show the video info of this listitem.
The reason for this is that the API only allows video details for one fixed video id at time so on the first run I list all items but without much info
and than if I want to display movie information the addon should list the info of the new listitem which now holds all good information.
My code to achieve this behaviour (from now by clicking on context menu) is as follows:
The problem is that the video information which is displayed is still from the old listitem, although I selected it 'True'.
Basically the algo would be:
If movie information button is clicked:
- get URI of this Listitem
- get param 'id' from URI
- download info based on 'id'
- create new list item which has more information
- show this listitem instead
Let's say my addon lists some streams and I focused one stream like in the following picture
My aim is now if I press the 'i' button to show video information of this item, to not show the video info of the selected item but instead
create a new listitem and show the video info of this listitem.
The reason for this is that the API only allows video details for one fixed video id at time so on the first run I list all items but without much info
and than if I want to display movie information the addon should list the info of the new listitem which now holds all good information.
My code to achieve this behaviour (from now by clicking on context menu) is as follows:
Code:
from resources.lib.api import get_json_data
def list_epg_item(id, SESSION):
url = 'apiurl...'
json_data = get_json_data(url, SESSION)
import xbmcgui, xbmc
item = xbmcgui.ListItem('Test title')
print('SELECT 1:', item.isSelected()) # prints False
item.select(True)
print('SELECT 2:', item.isSelected()) # prints True
xbmc.executebuiltin('Action(Info)')
The problem is that the video information which is displayed is still from the old listitem, although I selected it 'True'.
Basically the algo would be:
If movie information button is clicked:
- get URI of this Listitem
- get param 'id' from URI
- download info based on 'id'
- create new list item which has more information
- show this listitem instead