How to push my own ListItems into an existing Window
#1
I'm about to (re)write a plugin for a content scraper that collects TV highlights from a website and show them in a widget using a dynamic content list. This is already done and works. Items in the dynamic list are based on list items for example:
Code:

liz = xbmcgui.ListItem()
liz.setLabel('{} ({})'.format(item.get('pvrchannel', item.get('channel')), item.get('datetime').split(' ')[1]))
liz.setLabel2('{}'.format(item.get('title')))
liz.setInfo('video', {'genre': item.get('genre'), 'plot': item.get('plot'), 'duration': item.get('runtime'), 'rating': item.get('rating')})
liz.setArt({'icon': item.get('thumb'), 'thumb': item.get('thumb'), 'poster': item.get('thumb'), 'fanart': item.get('thumb'), 'logo': item.get('logo')})
liz.setProperty('StartTime', item.get('datetime'))
liz.setProperty('EndTime', item.get('enddate'))
liz.setProperty('RunTime', str(item.get('runtime') // 60))
liz.setProperty('Item', str(item.get('itemnumber')))
...and so on. Items of the widget list only shows a very small set of available labels (only icon, title, channel, starttime) - but thats ok. For more detailed info I want to use an existing window: pvrguideinfo with id 10600. The corresponding DialogPVRInfo.xml holds the info labels (ListItem.ChannelNumber, ListItem.Plot, ListItem.Art(fanart) and so on), but I'm fiddling for hours how to push my own ListItems from above into this window - or in other words - how can I transfer my ListItems created from script into this window?

What I've had trying among other things is to generate a separate ListItem in the manner above and then open the window:
Code:

li.xbmcgui.ListItem()
li.setInfo(video, {'plot': 'my Plot', 'genre': 'Comedy', ...})
li.setArt({'icon': pathToIcon, 'thumb': patToThumb})

win = xbmcgui.Window(10600)
win.show()
But none of the labels is shown.

In the past I have created my own WindowXMLDialog and filled it with Window(Home).properties, but for skin compatibility I don't want to use it, as its better to use the windows owned by the skin.

Any help would be greatly appreciated, code snippets are welcome.

If this thread is not in the right section, move it.
Reply
#2
as far as i know this isn't possible.
the pvr/epg integration in our python api is pretty much non-existing.
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#3
Really? I can't use any window from the skin and fill it with content from Python?
Reply
#4
@ronie I think You misunderstand me. Based on Your tutorial I want to use a skin xml file (DialogPVRInfo.xml) instead of "script-testwindow.xml".

Code:

win = myWin('DialogPVRInfo.xml', 'special://skin')
win.display()
del win

Lets have a look into the DialogPVRInfo.xml (partially, skin "Estuary"):
Code:

                <control type="textbox" id="400">
                    <left>660</left>
                    <top>20</top>
                    <width>1050</width>
                    <height>425</height>
                    <align>justify</align>
                    <label>$INFO[ListItem.ChannelName,,[CR]]$INFO[ListItem.Date,[COLOR grey]$LOCALIZE[552]:[/COLOR] ,[CR]
]$INFO[ListItem.Duration,[COLOR grey]$LOCALIZE[180]:[/COLOR] ,[CR]]$VAR[RecordingSizeLabel]$VAR[PremieredLabel]$INFO[ListItem.Rating,[COLOR grey]$LO
CALIZE[563]:[/COLOR] ,[CR]]$VAR[ExpirationDateTimeLabel]$INFO[ListItem.Genre,[COLOR grey]$LOCALIZE[515]:[/COLOR] ,[CR]]$INFO[ListItem.Writer,[COLOR 
grey]$LOCALIZE[20417]:[/COLOR] ,[CR]]$INFO[ListItem.Director,[COLOR grey]$LOCALIZE[20339]:[/COLOR] ,[CR]]$INFO[ListItem.Cast,[COLOR grey]$LOCALIZE[2
06]:[/COLOR] ,[CR]][CR]$INFO[ListItem.Plot]</label>
                    <autoscroll time="3000" delay="4000" repeat="5000">Skin.HasSetting(AutoScroll)</autoscroll>
                </control>

There is a textbox with id=400 and Infolabels from ListItems.

Lets have a look into the myWin class. What I've tried:

python:

class myWin(xbmcgui.WindowXML):
    def __init__(self, xmlFilename: str, scriptPath: str):
        super().__init__(xmlFilename, scriptPath)

    def onInit(self):
        xbmc.executebuiltin('Container.SetViewMode(50)')
        self.clearList()
        li = xbmcgui.ListItem()
        li.setInfo('video', {'plot': 'Plot of broadcast', 'ChannelName': 'BBC', 'genre': 'Crime', 'rating': '5'})
        li.setProperties({'plot': 'Plot of broadcast', 'ChannelName': 'BBC', 'genre': 'Crime', 'rating': '5'})
        self.getControl(400).addItem(li)

    def display(self):
        self.doModal()

The goal is to replace the listItem later with the listItem of the scraper. But i'm fiddling around this with no result. The Window appears indeed, but without content.
Reply
#5
(2020-12-22, 22:50)_BJ1 Wrote: I think You misunderstand me.

that is entirely possible ;-)

it's not clear to me if you're writing a plugin or a script (since you mention both).

for plugins, all you need to do provide the relevant infolabels using setInfo()
https://codedocs.xyz/xbmc/xbmc/group__py...2888fb5f14
for the info dialog to work, you need to specify the 'mediatype' in the setInfo() function.
the rest will be handled by kodi (ie. you press the info button / 'i' key and kodi will open the info dialog).

for scripts, you can create a listitem, again using setInfo() to provide the infolabels,
and use the xbmcgui.Dialog().info(listitem) function to open the infodialog.
https://codedocs.xyz/xbmc/xbmc/group__py...8a59800cd5

note, in both cases the video info dialog will be used. it is not possible to open the pvr info dialog.
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply

Logout Mark Read Team Forum Stats Members Help
How to push my own ListItems into an existing Window0