Setting info for a listItem?

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
Popeye Offline
Posting Freak
Posts: 875
Joined: Aug 2009
Reputation: 25
Location: Sweden
Post: #1
Background; The xbmc library has strm files with plugin:// url's to my addon. When selecting a strm file from the library view I want my addon to catch the selected list item and change the playcount of the item.

Using:
Code:
print xbmc.getInfoLabel( "ListItem.Title" )

In my code prints the list Items label.Meaning xbmc has in someway information on the just accessed listItem.
However when trying to change the info with this code:
Code:
win = xbmcgui.Window(xbmcgui.getCurrentWindowId())
                focus_id = win.getFocusId()
                # DEBUG just to get some feedback
                print focus_id
                print str(win.getControl( focus_id ).getSelectedPosition())
                print win.getFocus().getSelectedPosition()
                #
                win.getFocus().getSelectedItem().setInfo('video', { playcount: 1 })
Just results in:
Code:
00:16:20 T:4216  NOTICE: 50
00:16:20 T:4216  NOTICE: -1
00:16:20 T:4216  NOTICE: -1
00:16:20 T:4216   ERROR: Error Type: <type 'exceptions.AttributeError'>
00:16:20 T:4216   ERROR: Error Contents: 'NoneType' object has no attribute 'setInfo'
00:16:20 T:4216   ERROR: Traceback (most recent call last):
                                              File "C:\Users\Popeye\XBMC\portable_data\addons\xbmc-pneumatic\default.py", line 804, in <module>
                                                win.getFocus().getSelectedItem().setInfo('video', { playcount: 1 })
                                            AttributeError: 'NoneType' object has no attribute 'setInfo'
The -1 from getSelectedPosition() means I have no list and thus the NoneType error.

What am I doing wrong? What is the trick for manipulating listItems from xbmc (and not from my addon)?

sverigesradio | Pneumatic | SABnzbd | XBMC that just works - openelec
find quote