Play next item in List

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
captainloc Offline
Junior Member
Posts: 9
Joined: Feb 2012
Reputation: 0
Question  [RESOLVED] Play next item in List Post: #1
Hi,

I'm a begginner in Python and XBMC and i would like to make some improvements to my first plugin. For now, i'm getting a list of files from a XML file. I'm adding each elements with this function :

Code:
def addLink(name,url,iconimage):
        ok=True
        liz=xbmcgui.ListItem(name, iconImage="DefaultVideo.png", thumbnailImage=iconimage)
        liz.setInfo( type="Video", infoLabels={ "Title": name } )
        liz.setProperty('IsPlayable', 'true')
        ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=url,listitem=liz)
        return ok

I would like to be able to jump to the next file in the list automatically at the end of the playback or pressing the next button. Is there a way to do it ?
Thanks a lot

Loc
(This post was last modified: 2012-02-20 18:41 by captainloc.)
find quote
jmarshall Offline
Team-XBMC Developer
Posts: 24,564
Joined: Oct 2003
Reputation: 138
Post: #2
XBMC will do that automatically for you assuming you are writing an audio plugin? You could try setting provides to audio to see if that will do it.

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]
find quote
captainloc Offline
Junior Member
Posts: 9
Joined: Feb 2012
Reputation: 0
Post: #3
Hey,

Thanks for your answer.
It's not an audio plugin but a video plugin Sad and it's not doing it automatically. When i press next, XBMC told me that it's not a playlist
find quote
jmarshall Offline
Team-XBMC Developer
Posts: 24,564
Joined: Oct 2003
Reputation: 138
Post: #4
If you change it to an audio plugin (it can still serve up videos) see if that will do it automatically.

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]
find quote
captainloc Offline
Junior Member
Posts: 9
Joined: Feb 2012
Reputation: 0
Post: #5
Thanks a lot. It worked Smile
find quote
captainloc Offline
Junior Member
Posts: 9
Joined: Feb 2012
Reputation: 0
Post: #6
Actually no, it didn't work on all plateform. On my Mac it's ok, but on my AppleTV which is the final destination of my plugin, it's not working.

Do you have any idea how to do it properly ?
find quote
SniperCharlie Offline
Junior Member
Posts: 23
Joined: Mar 2008
Reputation: 0
Post: #7
I am having the same issue - no matter what I try the next item in the list will not be queued. I verified my XBMC settings. I even tried pulling the final URL destination using urllib2 (since the URL i'm scraping involves a re-direct) and giving that to the item. The scraping of the redirection added a long delay, and ended up not solving it.

I've also added in xbmcplugin.setContent(content="audio") tags throughout items, and folder structures. The addon.xml is advertising it provides audio. Not sure what else to do. I did read one forum post that indicated they were able to get around the bug by using setresolvedURL commands, but I couldn't make that work at all.

I pull in a json file, parse it, clean it up, and then decode it. I'm sure there are better ways, but I've (just now) taught myself some python basics.

Relevant snippits of code:

Code:
def INDEX(url):
    req = urllib2.Request(url)
    req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3')
    response = urllib2.urlopen(req)
    raw_json=response.read()
    response.close()
    parsed_json=json.loads(raw_json)
    del parsed_json['version']
    print 'Parsed_Json_output'
    decoded_json =_decode_dict(parsed_json)
    print 'decoded_json_output'
    playlist = sortedDictValues1(decoded_json)
    print 'Sorted_playlist_output'
    xbmcplugin.setContent(handle=int(sys.argv[1]), content="audio" )
    for x in playlist:
        artist = x['artist']
        title = x['title']
        url = x['stream_pub']
        thumb = x['thumb_url_large']
        name = artist + ' - ' + title
        addLink(name,url,thumb)

Code:
def addLink(name,url,iconimage):
    xbmcplugin.setContent(handle=int(sys.argv[1]), content="audio" )
    ok=True
    liz=xbmcgui.ListItem(label=name,thumbnailImage=iconimage, path=url)
    liz.setProperty("mimetype", 'audio/mpeg')
    liz.setInfo("music", {"title": name,})
    liz.setProperty('IsPlayable','true')
    ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=url,listitem=liz,isFolder=False)
    return ok
        
def addDir(name,url,mode,iconimage):
    xbmcplugin.setContent(handle=int(sys.argv[1]), content="audio" )
    u=sys.argv[0]+"?url="+urllib.quote_plus(url)+"&mode="+str(mode)+"&name="+urllib.quote_plus(name)
    ok=True
    liz=xbmcgui.ListItem(name,iconImage="DefaultFolder.png",thumbnailImage=iconimage)
    liz.setInfo( type="music", infoLabels={ "Title": name } )
    liz.setProperty('IsPlayable','true')
    ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=True)
    return ok
find quote
jmarshall Offline
Team-XBMC Developer
Posts: 24,564
Joined: Oct 2003
Reputation: 138
Post: #8
If it didn't work on your ATV, then that suggests your ATV has an older version of XBMC. IIRC it was fixed in one of the beta's (b2 maybe?)

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.


[Image: badge.gif]
find quote