Implementation of a user extendible list of internet streams
#1
Hey all,

I'm absolutely new to plugin development in xbmc, so please excuse a maybe dumb question :-).
For a seminar paper, I want to implement a recording functionality for radio streams (amongst other
things, for example capture video streams, but this is another topic...). I suppose it shouldn't be that
hard, as it is no problem to call - for instance - streamripper from a python script.

So my question is more of a design issue: I'm wondering how to implement a list of radio streams
that can be changed by the user. I'm thinking of something like:

<radio station 1> : <url of radio stream 1>
<radio station 2> : <url of radio stream 2>

I could implement this by adding each station as a setting to the settings.xml, however this would mean that the user
cannot add new radio stations, as there seems to be no xbmc function to add new settings. I also think
this is not the right place to store such information, but how would you guys do this?

In the end I'm thinking of presenting the user a list of radio stations and he can choose which one to record
and for how long (or even at what time to start recording).

So it would be great if you could give me some hints where to start, or if there is some plugin with an already similar
functionality? (at least I didn't find one)

Thanks in advance for helping...

Kind regards

Tobias
Reply
#2
Store a suggested sample of stations as a xml/json and then add these to a sqlite db or a pickled dict at first start. Next step is to generate the listitems using the stored data...
Pneumatic | SABnzbd | XBMC that just works - openelec
Reply
#3
Thanks, I get it and already implemented it. I just created an XML-file and read/write it
with Python's ElementTree XML API.

Now I'm thinking of creating an interface for the user where it's possible to define some
settings for the download of the radio stream, for instance the duration, start time, etc.
So perhaps by giving an additional option in the context menu of the selected radio stream.

This should be no problem, however is it possible to create a user interaction menu other than
for the settings of the plugin, i.e. creating text fields for user input, etc.

I guess any hint for a documentation on this would help me a lot...

Thanks again!

Tobias
Reply
#4
Not without building your own window.xml. But you could create explicit context menu items for entering data. Look at the documentation for xbmcgui.Dialog(), http://mirrors.xbmc.org/docs/python-docs...tml#Dialog
Pneumatic | SABnzbd | XBMC that just works - openelec
Reply
#5
I'm doing some progress here, thanks to your help :-).

However there is some other issue right now:
I create a list of radio stations, however in order to speed things up, I recall the plugin
and subsequently use setResolvedUrl to finally play the stream:

Code:
url = self._pluginName + "?mode=play&url=" + playbackURL
listItem = xbmcgui.ListItem(station)
listItem.setProperty("IsPlayable", "true")
xbmcplugin.addDirectoryItem(self._pluginId, url, listItem)

and later:

Code:
listItem = xbmcgui.ListItem(label=params["station"][0], path=params["url"][0])
xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, listItem)

This is working fine, except for the case when the playpath is a m3u playlist. In this case
I get an Error like this:

Code:
ERROR: Playlist Player: skipping unplayable item: 0, path [plugin://plugin.audio.recorder/?mode=play&url=http://mp3-live.dasding.de/dasding_m.m3u]

Am I missing something here? If I create the listItems directly with the url and I don't use setResolvedUrl
everything works fine (also with the playlist file), however it takes a long time until the directory is listed.
Do I manually have to get the url from the playlist file in order to be able to use it with setResolvedUrl?
Reply
#6
http://forum.xbmc.org/showthread.php?tid=118083
Pneumatic | SABnzbd | XBMC that just works - openelec
Reply
#7
Yes, I read this post and was happy to finally have found a solution for speeding the listing up :-).
Again, everything is working fine, except when the playpath is a .m3u file. The final url is in this
playlist file, but does that mean I have to read it from the file by myself before calling setResolvedUrl?
Reply
#8
But what about using the listitem.setProperty('mimetype', 'video/x-msvideo') trick sphere suggested and skip the setResolvedUrl?
Pneumatic | SABnzbd | XBMC that just works - openelec
Reply

Logout Mark Read Team Forum Stats Members Help
Implementation of a user extendible list of internet streams0