Open DialogVideoInfo.xml for a specified movie?
#1
I am trying to open the WINDOW_DIALOG_VIDEO_INFO dialog for an existing movie after click on an item in a list.  Basically the same behavior as the built-in search when clicking on an Actor or Director and then on a search result.

It seems like something like this won't work...

python:
ActivateWindow(12003,"videodb://movies/4131/",return)

...because this window only seems to open for the currently selected list item, and the secondary parameter seems to be ignored.

I found an older post https://forum.kodi.tv/showthread.php?tid...ight=12003 where @ronie pointed someone to xbmcgui.Dialog().info(listitem).

But I'm still having trouble using that to open DialogVideoInfo.xml for a specified movie.

Something like...

python:
li = cntrl.getSelectedItem()
label = li.getLabel()
dialog = xbmcgui.Dialog(li.setInfo("video",{"title":label}))
dialog.info(li)

...will create a new instance (that happens to be populated with my target movie's title).  But is there any way to just open the dialogue for a specified movie?
Maintaining a few add-ons for v18 including PseudoTV (Classic), Tag Overview, and Autosub: https://github.com/fnord12
Reply
#2
(2019-09-10, 20:17)fnord12 Wrote: I am trying to open the WINDOW_DIALOG_VIDEO_INFO dialog for an existing movie after click on an item in a list.  Basically the same behavior as the built-in search when clicking on an Actor or Director and then on a search result.

It seems like something like this won't work...

python:
ActivateWindow(12003,"videodb://movies/4131/",return)

...because this window only seems to open for the currently selected list item, and the secondary parameter seems to be ignored.

I found an older post https://forum.kodi.tv/showthread.php?tid...ight=12003 where @ronie pointed someone to xbmcgui.Dialog().info(listitem).

But I'm still having trouble using that to open DialogVideoInfo.xml for a specified movie.

Something like...

python:
li = cntrl.getSelectedItem()
label = li.getLabel()
dialog = xbmcgui.Dialog(li.setInfo("video",{"title":label}))
dialog.info(li)

...will create a new instance (that happens to be populated with my target movie's title).  But is there any way to just open the dialogue for a specified movie?
Documents below... ".... a specified movie" depends on the listitem you are passing and how your code functions. ie if you want a specific movie pass its listitem.

https://codedocs.xyz/xbmc/xbmc/group__py...8a59800cd5
Image Lunatixz - Kodi / Beta repository
Image PseudoTV - Forum | Website | Youtube | Help?
Reply
#3
Thanks for the response, @Lunatixz   That's the documentation that Ronie pointed to, but i guess what i don't understand is how or where to "get" the ListItem.

So if i'm doing something like this in a function..

python:
li = xbmcgui.ListItem()
debug(li)
self.displayVideoInfo(li)

...and then this is what's called...

python:
def displayVideoInfo(self,li):
        xbmc.executebuiltin('Dialog.Close(all,true)')
        dialog = xbmcgui.Dialog(li)
        dialog.info(li)

...I see "<xbmcgui.ListItem object at 0x000000002C0B12D8>" written to my debug log, and no errors, but nothing happens (aside from the open dialogs correctly closing).

But your comment has i think helped me along since i'm trying to pass the ListItem now instead of trying to get it in the displayVideoInfo function.  I'm probably still trying to get the ListItem in the wrong place.  So i appreciate your help and i'll keep trying.
Maintaining a few add-ons for v18 including PseudoTV (Classic), Tag Overview, and Autosub: https://github.com/fnord12
Reply
#4
(2019-09-10, 22:23)fnord12 Wrote: Thanks for the response, @Lunatixz   That's the documentation that Ronie pointed to, but i guess what i don't understand is how or where to "get" the ListItem.

So if i'm doing something like this in a function..

python:
li = xbmcgui.ListItem()
debug(li)
self.displayVideoInfo(li)

...and then this is what's called...

python:
def displayVideoInfo(self,li):
        xbmc.executebuiltin('Dialog.Close(all,true)')
        dialog = xbmcgui.Dialog(li)
        dialog.info(li)

...I see "<xbmcgui.ListItem object at 0x000000002C0B12D8>" written to my debug log, and no errors, but nothing happens (aside from the open dialogs correctly closing).

But your comment has i think helped me along since i'm trying to pass the ListItem now instead of trying to get it in the displayVideoInfo function.  I'm probably still trying to get the ListItem in the wrong place.  So i appreciate your help and i'll keep trying.
Can you post full code? Where are your trying to get the listitem from? Your example is an empty listitem object.
There are a few ways to get a listitem.... It would help put things in context if you could explain your project goal... what type of script are you writing? THX

BTW don't use  xbmc.executebuiltin('Dialog.Close(all,true)') this is a faux pas
Image Lunatixz - Kodi / Beta repository
Image PseudoTV - Forum | Website | Youtube | Help?
Reply
#5
I appreciate your willingness to help.

What I am ultimately trying to do is create a customized search results list when clicking on directors/actors (see here: https://forum.kodi.tv/showthread.php?tid=346455).

I am starting "small" by just trying to create a search for Directors.  I am using another addon, TagOverview, as my starting point and trying to repurpose the code.  
This is probably leading me astray and I should probably step back and just create a simple add on from scratch.  But using this addon has gotten me pretty far.

I am able to successfully trigger my script by clicking on the director field from my skin and create a list of all movies with the appropriate director.

This is the code that builds the list dialog:

python:
def buildList(self):
        movies = self.vdb.GetMovies()
        control=self.getControl(MOVIELIST)
        for movie in movies:
           control.addItem(self.createListItem(movie[1],movie[0]))

def createListItem(self, label, movieid):
        li = xbmcgui.ListItem(label)
        li.setProperty(PROPERTY_MOVIEID, str(movieid))
        return li

What I am trying to do now is handle the action of clicking on a specific movie.

python:
def onAction(self, action):
        if not (action.getId() == ACTION_SELECT_ITEM) or not (action.getId() == ACTION_SELECT_ITEM2):
            self.onAction1(action)  #cancels
        if (action == ACTION_SELECT_ITEM) or (action == ACTION_SELECT_ITEM2):
            controlId = self.getFocusId()
            if controlId == MOVIELIST:
                li = xbmcgui.ListItem Huh  #this is where I'm failing to properly get the ListItem.
                
                displayVideoInfo(li)
            if controlId == TAGMGMTBTN:  #legacy from tagoverview; ignore for now
                self.openTagOverview()
                self.close()

 def displayVideoInfo(self,li):
        xbmc.executebuiltin('Dialog.Close(all,true)')  #thought I needed to close out the currently opened DialogVideoInfo.xml before opening a new one
        dialog = xbmcgui.Dialog(li)
        dialog.info(li)

Looking at what examples I can find, this is probably a bad way of doing things and I should probably start from scratch.  But digging through this code has helped me learn things.  Any additional help would be appreciated but I'd also certainly understand hearing "stop what you are doing".  Smile
Maintaining a few add-ons for v18 including PseudoTV (Classic), Tag Overview, and Autosub: https://github.com/fnord12
Reply
#6
you should be able to get the listitem like this:
python:
li = self.getControl(controlId).getSelectedItem()

also, dialog = xbmcgui.Dialog(li) is incorrect, it's simply dialog = xbmcgui.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
#7
Thanks for the response, Ronie.

I am still getting "xbmcgui.ListItem object at 0x0000000017CDE440" in my debugger, so i'm still missing something, but you've helped show me the right syntax so i can try to keep working with it.

(What should a ListItem value look like?)
Maintaining a few add-ons for v18 including PseudoTV (Classic), Tag Overview, and Autosub: https://github.com/fnord12
Reply
#8
the listitem is an object, so what you're seeing in your log is correct.

looking at your listitem creation code, that is lacking a bit...
there are multiple info dialogs in kodi (video info dialog / music info dialog) and without defining what kind of listitem it is, kodi will not be able to open the right info dialog.
next, you'll need to provide the path of the file. kodi will use this to lookup the item in the db and fetch all additional metadata. without it, all you'll get is an empty info dialog.

python:
def createListItem(self, label, movieid):
        li = xbmcgui.ListItem(label)
        li.setProperty(PROPERTY_MOVIEID, str(movieid))
        # add a video info tag, so kodi knows it's a video item
        li.setInfo('video', {})
        # set the path to the file, kodi will use it to fetch additional info from the db
        li.setPath('/path/to/the/movie/file.ext')
        return li
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
#9
Thank you Ronie!  It works!! Smile   I guess I had some magical thinking about the ID field being enough to identify the movie.  I REALLY appreciate your help.

@Lunatixz thanks you for your help too.  And FYI i'm now using self.close instead of Dialog.Close(all,true).   ;-)

I honestly was a little afraid to post my question because i know i'm a bit out of my depth with this stuff and i thought i'd get my head bitten off.  But you guys have been awesome.
Maintaining a few add-ons for v18 including PseudoTV (Classic), Tag Overview, and Autosub: https://github.com/fnord12
Reply
#10
Is there a different method for opening Open DialogVideoInfo.xml for a specific TVShow?

With the help from @ronie I've been able to activate the window for Movies and Episodes.  But using the same method for TVShows doesn't work.  The self.close() portion executes and then I get an unusual message in my debug log:

ERROR: CGUIWindowVideoBase::ShowIMDB: could not add episode [D:\TV\Seinfeld\]. tvshow does not exist yet.

The path is correct and I'm not intending to do anything with IMDB.

Peeking at the globalsearch addon, I've found an alternative way of handling things by using Activate Window to go to the Browse/Season List page instead.  And I could live with that, but going to the DialogVideoInfo page (like in the built-in actor/director search) would be preferable.
Maintaining a few add-ons for v18 including PseudoTV (Classic), Tag Overview, and Autosub: https://github.com/fnord12
Reply

Logout Mark Read Team Forum Stats Members Help
Open DialogVideoInfo.xml for a specified movie?0