Win [Help] Creating a playlist, where the additional links are created later
#1
I'm really new at xbmc plugin development and python.

I'm working on a video addon, the page has the video in parts - when you go to the page, the first part starts playing and when it ends the user needs to click the next thumbnail to continue playing the 2nd and other parts.

I'm trying to create a playlist, where the first item is a proper link to a video, but the other ones are internal plugin links that are only resolved when needed (2nd video link is resolved after the 1st part finishes playing, and so on)

relevant parts of my code:

Code:
playlist = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
playlist.clear()

listitem = xbmcgui.ListItem(name)
listitem.setInfo('video', {'Title': name})
playlist.add(vidUrl['video'], listitem)

if vidUrl['relVids'] and len(vidUrl['relVids']) > 0:
    partCount = 1
    for rel in vidUrl['relVids']:
        partCount=partCount+1
        title = 'part ' + str(partCount)
        li = xbmcgui.ListItem(title)
        li.setInfo('video', {'Title': title})
        u=sys.argv[0]+"?url="+urllib.quote_plus(rel)+"&mode=8"
        playlist.add(u, li)

xbmc.executebuiltin('playlist.playoffset(video,0)')

Passing mode=8 causes this:

Code:
vidUrl = FIND_VIDEO_URL(url)
xbmc.Player().play(vidUrl, xbmcgui.ListItem())

FIND_VIDEO_URL resolves the url into a media url. But I don't think it even reaches this stage, I get this message in the logs:
Code:
ERROR: Playlist Player: skipping unplayable item: 1, path [plugin://my.namespace/?url=http%3A%2F%2Fserver%2Fvideo-page-12345.html&mode=8]

I'm having a hard time finding an existing addon that uses a similar approach, so I don't know how to proceed.
I've seen addons use a method called setResolvedUrl, but I'm not sure if it applies to my case or where to call it.

Any ideas? Thanks!
Reply
#2
When adding the listitem you .setProperty('IsPlayable', 'true') - Then instead of
Code:
vidUrl = FIND_VIDEO_URL(url)
xbmc.Player().play(vidUrl, xbmcgui.ListItem())

something like this -
Code:
vidUrl = FIND_VIDEO_URL(url)
item = xbmcgui.ListItem(path=vidUrl )
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, item)
Reply
#3
Ahhh... yes, google was useless for setResolvedUrl, but this isPlayable keyword is what I needed Smile Thanks, trying it now!
Reply
#4
Awesome, it worked beautifully, I knew it could be done! :-)

for future reference: I found a great example here: https://github.com/t0mm0/t0mm0-xbmc-plug...default.py
Reply

Logout Mark Read Team Forum Stats Members Help
[Help] Creating a playlist, where the additional links are created later0