PDA

View Full Version : Create playlist in python an play it?


Gujs
2009-08-12, 09:02
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:
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:
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?

rwparris2
2009-08-12, 10:14
You have to tell it you play the playlist.
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.

Gujs
2009-08-12, 13:49
That works! Thanks!

afeno
2009-10-15, 00:04
That works! Thanks!

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


Thanks.
Afeno.