def __init__(self, windowId = 0): if(windowId > 0): window = xbmcgui.Window(windowId) else: window = kodi_json.kodi_execute_json({"method" : "GUI.GetProperties", "params" : { "properties" : ["currentwindow"]}}) self.Id = int(window['result']['currentwindow']['id']) self.Label = window['result']['currentwindow']['label']
def get_items(self): items = [] itemsCount = kodi_json.kodi_execute_json({"method" : "XBMC.GetInfoLabels", "params" : { "properties" : ["Container(0).NumItems"]}}) for i in range(0, self.ItemCount): items.append('"Container(0).ListItem(' + str(i) + ').Label"') items.append('"Container(0).ListItem(' + str(i) + ').FolderPath"') # Next function the user should select an item self.NextFunction = self.select_and_play_item self.NeedsUserInput = True return '{"jsonrpc":"2.0","method":"XBMC.GetInfoLabels","id":"1","params":{"labels":[' + ','.join(items) + ']}}'
def loadItems(self, infoLabel, numberOfItems, listField, itemType): xbmc.log(msg = "loadItems(" + infoLabel + ", " + str(numberOfItems) + ", " + str(listField) + ", " + str(itemType) + ")") listField = [] labels = [] for i in range(0, numberOfItems): className = self.__class__.__name__ + "." + infoLabel + "(" + str(i) + ")" xbmc.log(msg="className: " + className) for label in dir(itemType): xbmc.log(msg = "dir label: " + label) if(not label.startswith("_") and not inspect.ismethod(getattr(itemType, label))): labels.append(className + "." + label) labelResults = kodi_json.kodi_execute_json({"method" : "XBMC.GetInfoLabels", "params" : { "labels" : labels }}) self.setProperties(labels, labelResults, infoLabel, itemType)
def load(self): labelResults = kodi_json.kodi_execute_json({"method" : "XBMC.GetInfoLabels", "params" : { "labels" : self._Labels }}) self.setProperties(self._Labels, labelResults, self._ClassName)
def __init__(self): window = kodi_json.kodi_execute_json({"method" : "GUI.GetProperties", "params" : {"properties" : '["currentwindow"]'}}) xbmc.log(msg="KODI_LIST: " + json.dumps(window), level=xbmc.LOGDEBUG)
def play(self): params = {"method": "Player.Open", "params": {"item": {"file": self.FolderPath}}} kodi_json.kodi_execute_json(params)