Help with streaming ogg from HTTP (Spotify)
#1
Hi,

I'm new to python and XBMC plugin development. I'm working on an integration with Spotify. I have got it working now and I can search and play songs but as soon as I change the type to "music" with the setInfo method on ListItem XBMC won't play the stream any more. In the log file I get " ERROR: CAudioDecoder: Unable to Init Codec while loading file http://localhost:8080/stream"

I add all the listitems using this method:
Code:
liz=xbmcgui.ListItem(name, iconImage=iconimage, thumbnailImage=iconimage)
liz.setInfo(type="music", infoLabels={ "title": name, "artist": artist, "album": album } )
ok=xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=url,listitem=liz,isFolder=False)

url is an http URL to an ogg stream (eg. http://localhost:8080/stream).

If I change the type from "music" to anything else it plays (but using the DVDPlayer I think) but then I can't see the song information etc.

Thanks for any help.

Bobo
Reply
#2
After I posted this I found this post. Seems like he has the same problem.
Reply
#3
you can get it to work by setting the url to direct back to the plug with a "mode" say "play", and pass the url encoded also, and then from the plugin do
(i also pass some meta data though also)

Code:
def play_stream(url, title, info):
  listitem = xbmcgui.ListItem(title)
  listitem.setInfo ( 'music', info )
  player = xbmc.Player(xbmc.PLAYER_CORE_MPLAYER)
  player.play(url, listitem)

this way it can play, but now xbmc doesnt know "where we are" in the directory list. it also messes up the item working correctly from a playlist.

here is my code:

http://code.google.com/p/xbmc-addons/sou...default.py

I think the main fault here is that xbmc incorrectly chooses PAPLAYER for a file it can't actually play (doesnt work over http). And unfortunately there seems to be no way to currently "switch" the player from a plugin/script for each "item".
Reply
#4
I debugged it further. XBMC chooses PAPLAYER which does support http, but then it doesnt recognise the OGG file and tries to play it as an mp3.

I made a patch that fixes this.

http://trac.xbmc.org/ticket/8447
Reply

Logout Mark Read Team Forum Stats Members Help
Help with streaming ogg from HTTP (Spotify)0