v16 Addon window always change its ID ?
#1
I create my own script addon with its own custom window . In xml file ive specified this window id (for example window id="3002" ) but i see that kodi start it with different some unpredictable IDs (it can be 13002 or 13001 or 13003) ?  In this connection i cant provide correct keyboard.xml file !
What can i do for correct work ? Thank You  in advance
Reply
#2
Window ids are assigned on demand, You can't predefine them. Control ids are another matter and can be defined.

Use the below in your script to find your window id, also if you can go into details perhaps we can figure out how to solve your problem.

python:
xbmcgui.Window(xbmcgui.getCurrentWindowId())

BTW moving thread to appropriate subform.
Image Lunatixz - Kodi / Beta repository
Image PseudoTV - Forum | Website | Youtube | Help?
Reply
#3
Hi  , Lunatixz ! 
Thank You for answer 

1) Pls suggest where i should move my thread ?
2) About problem details :
Im trying to do my addon\script for manage flash card media files  . There should be flash card media files names list , the mediainfo  and preview videowindow for selected list item.
I have created addon with corresponding file structure , where the custom_media.xml its a skin xml file,  and default.py its a python script .By my plan i should run in the list up and down , and after push "return" on the needed item , video should start in preview window and show some media info below this window  .
All is working except off i cant start video in preview window. When i push "return" (select item)  just on the short moment i see  this video in the preview and then fullscreen video playing starts .... 
In code this looks like :

def onAction(self, action):
        item = self.cont1.getSelectedItem()
        item.setProperty('IsPlayable', 'true')
        if action == ACTION_SELECT_ITEM :
            title = ""
            try:
                xlistitem = xbmcgui.ListItem( title, iconImage="DefaultVideo.png", path=item.getProperty('fullpath'))
            except:
                xlistitem = xbmcgui.ListItem( title, iconImage="DefaultVideo.png", )
            xlistitem.setInfo( "video", { "Title": title } )
            xlistitem.setProperty('IsPlayable', 'true')
            player_type = xbmc.PLAYER_CORE_AUTO
            xbmcPlayer = xbmc.Player(player_type)
            xbmcPlayer.play(item.getProperty('fullpath'),xlistitem,True,0)

I think this is because of in keyboard.xml global section , the "return" key action is defined like "Select" .
So thats why i have tried to define custom_media.xml window permanent ID like <window id="3002"> (3002 - its a custom python windows diapason ) to define this window special section in keyboard.xml (for excluse global key reaction) .
Reply
#4
I already moved the thread to addon development Smile

The issue you are having is with the listitem. Your script is at conflict with Kodis built-in functions; this is easily fixed.

Remove the "path" url from your listitem and keep a custom setProperty with your path, Kodi will ignore the "select" action when viewing the listitem. Proceed with your window "onAction" and use listitem.getSelectedItem to acquire the appropriate custom property in order to play the media.

Your playback expression is correct, you have windowed mode "True"... and I'm assuming you included a "videowindow" control type in your skin.
Image Lunatixz - Kodi / Beta repository
Image PseudoTV - Forum | Website | Youtube | Help?
Reply
#5
Hi  , Lunatixz ! 

It seems to me that im doing something wrong Smile  because my script not working as needed 
Did I understand you correct and coorect script in a right way 

def onAction(self, action):
        item = self.cont1.getSelectedItem()
        item.setProperty('IsPlayable', 'true')
        if action == ACTION_SELECT_ITEM :
            title = ""
            xlistitem = xbmcgui.ListItem( title, iconImage="DefaultVideo.png")
            xlistitem.setInfo( "video", { "Title": title } )
            xlistitem.setProperty('IsPlayable', 'true')
            player_type = xbmc.PLAYER_CORE_AUTO
            xbmcPlayer = xbmc.Player(player_type)
            xbmcPlayer.play(item.getProperty('fullpath'),xlistitem,True,0)
 
I dont understand where  i should use listitem.getSelectedItem ....

Here all script :
default.py
Reply
#6
a few remarks:

- i would recommend to use OnClick() to handle select actions instead of onAction()
- getSelectedItem() will return the selected listitem, so there's no need to recreate it
- specifying the player core is deprecated and should not be used anymore
- setting the 'IsPlayable' property is only needed for plugins, it useless in scripts

this might be a good starting point:
python:
    def onClick(self, controlId):
        if controlId == 50:
            xlistitem = self.cont1.getSelectedItem()
            xbmc.Player().play(xlistitem.getProperty('fullpath'),xlistitem,True)

if this still results in the video being played fullscreen, please post a Debug Log and the .xml file as well.
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
#7
Hi Lunatixz and Ronie !
Thank You so much for help ! I have resolved my problem Smile
Reply

Logout Mark Read Team Forum Stats Members Help
Addon window always change its ID ?0