How ListItem Infolabel works?

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
Tomas Offline
Junior Member
Posts: 10
Joined: Jul 2012
Reputation: 0
Post: #1
Hello,
I would like to intergrate DialogVideoInfo.xml info my addon. But I do not understand how to populate $INFO[ListItem.Writer] etc..
So my question is: how to overwrite $INFO[ListItem....] variables from within python code?
I do not want to overwrite DialogVideoInfo because it is available in every skin.

I tried everything

Code:
class XMLRatingDialog(xbmcgui.WindowXMLDialog):
    """
    Dialog class that asks user about rating of movie.
    """
    def __init__(self, *args, **kwargs):
        pass
        self.setProperty("Title", "Title")
        self.setProperty("Title", "Title")
        self.setProperty("Video.Icon", "https://s3.amazonaws.com/titles.synopsi.tv/01982155-267.jpg")
        # self.getControl(49).setProperty("Title", "Title")

    def message(self, message):
        """
        Shows xbmc dialog with OK and message.
        """
        dialog = xbmcgui.Dialog()
        dialog.ok(" My message title", message)
        self.close()

    def onInit(self):
        pass
        # self.getControl(49).setProperty("Title", "Title")
        # setStaticContent
        lis = []
        liz=xbmcgui.ListItem("Film", iconImage="DefaultFolder.png", thumbnailImage="DefaultFolder.png")
        liz.setInfo( type="Video", infoLabels={ "Label": "Film" } )

        lis.append(lis)
        self.getControl(49).addItem(liz)
        # self.getControl(49).setStaticContent(items=liz)
        xbmcplugin.endOfDirectory(int(sys.argv[1]))

    def onClick(self, controlId):
        if controlId == 11:
            pass
        self.close()

    def onFocus(self, controlId):
        self.controlId = controlId

    def onAction(self, action):
        if (action.getId() in CANCEL_DIALOG):
            self.close()


def show_movie_dialog():
    """
    Show movie dialog.
    """
    ui = XMLRatingDialog("DialogVideoInfo.xml", __cwd__, "Default")
    ui.doModal()
    del ui
find quote
hippojay Offline
Fan
Posts: 301
Joined: Mar 2008
Reputation: 13
Location: Sheffield, UK
Post: #2
For those items (writer, directory, etc) you set them directly in xbmc.ListItem. I tend to create a Dict and populate the items, then feed that into listItem. Here is an extract from my code, so you can see what items you can use - also check out the documentation for a more comprehensive list (this is just video stuff)

In addition, some can be set with setproperrty( item, value) - which can be picked up as listItem.property(item).

Also, there are some skin ListItem properties that you cannot over write from within an addon at the moment such as VideoResolution (unless you are using frodo) and IsResumable

Code:
#Required listItem entries for XBMC
    details={'plot'      : movie.get('summary','') ,
             'title'     : movie.get('title','Unknown').encode('utf-8') ,
             'playcount' : int(movie.get('viewCount',0)) ,
             'rating'    : float(movie.get('rating',0)) ,
             'studio'    : movie.get('studio','') ,
             'mpaa'      : "Rated " + movie.get('contentRating', 'unknown') ,
             'year'      : int(movie.get('year',0)) ,
             'tagline'   : movie.get('tagline','') ,
             'duration'  : str(datetime.timedelta(seconds=duration)) ,
             'overlay'   : _OVERLAY_XBMC_UNWATCHED }
    
    #Extended Metadata
    if g_skipmetadata == "false":
        details['cast']     = tempcast
        details['director'] = " / ".join(tempdir)
        details['writer']   = " / ".join(tempwriter)
        details['genre']    = " / ".join(tempgenre)
(This post was last modified: 2012-08-08 14:03 by hippojay.)
find quote