Create playlist in python an play it?
#1
Hi all, I am trying to create one playlist in python and then play it, but it doesn't seem to work. The worst thing is that I don't get any error messages so I don't know what is wrong.

Here is the script:
Code:
import xbmc, xbmcgui

xbmc.PlayList(1).clear()

listitem = xbmcgui.ListItem('Slovenija 1',
thumbnailImage='/home/iskratel/logo_tvslovenija1.jpg')
url = 'udp://@227.111.2.10:12345'
xbmc.PlayList(1).add(url, listitem)

listitem = xbmcgui.ListItem('Slovenija 2',
thumbnailImage='/home/iskratel/logo_tvslovenija2.jpg')
url = 'udp://@227.111.2.11:12345'
xbmc.PlayList(1).add(url, listitem)

xbmc.Player().play()

This just loads two items into playlist and then starts a player, but player doesn't start.


I also tried just to play one of those streams without adding it to playlist, and that worked ok:
Code:
listitem = xbmcgui.ListItem('Slovenija 2',
thumbnailImage='/home/iskratel/logo_tvslovenija2.jpg')
url = 'udp://@227.111.2.11:12345'

xbmc.Player().play(url, listitem)

Can somebody tell me what am I doing wrong in first script?
Reply
#2
You have to tell it you play the playlist.
Code:
import xbmc, xbmcgui

pl=xbmc.PlayList(1)
pl.clear()

listitem = xbmcgui.ListItem('Slovenija 1',
thumbnailImage='/home/iskratel/logo_tvslovenija1.jpg')
url = 'udp://@227.111.2.10:12345'
xbmc.PlayList(1).add(url, listitem)

listitem = xbmcgui.ListItem('Slovenija 2',
thumbnailImage='/home/iskratel/logo_tvslovenija2.jpg')
url = 'udp://@227.111.2.11:12345'
xbmc.PlayList(1).add(url, listitem)

xbmc.Player().play(pl)
Untested, but I'm fairly sure that's how it works.
Always read the XBMC online-manual, FAQ and search and search the forum before posting.
For troubleshooting and bug reporting please read how to submit a proper bug report.

If you're interested in writing addons for xbmc, read docs and how-to for plugins and scripts ||| http://code.google.com/p/xbmc-addons/
Reply
#3
That works! Thanks!
Reply
#4
Gujs Wrote:That works! Thanks!

Is this scrip also valid for videos bradcasted via UDP?
Does XBMC support video play from UDP source.


Thanks.
Afeno.
Reply
#5
thanks so much
Reply

Logout Mark Read Team Forum Stats Members Help
Create playlist in python an play it?0