Hi,
Can you please share a sample code which fetches the station list from
the> Icecast server and can play a station.
>
I am attaching a very basic, bare-bone example in Python which:
- fetches the XML file
- converts it into a DOM object
- loops over it, extracting for each station it's server name, URL, bitrate
and genre.
To play a URL, just feed it to the underlying player.
There are many other interesting things you can do from here on, like build
a local cache, make a search by genre - and even avoid some caveats like
broken UTF or HTML escaped characters in names and URLs etc.
For a full-featured example, you can check out this project: svn://
svn.online.bg/plugin.audio.icecast/TRUNK - this is an Icecast plugin for
XBMC media centre. It is Python and uses XBMC as a player. It stores the
station list locally (either plain text file or SQLite) and auto-updates it
at certain intervals; has a search; a favourites list; a recently listened
list etc. It also deals with HTML escaped characters in names and URLs.
More detaled description is here:
http://bilbo.online.bg/~assen/icecast-addon/
Following the concept you can write the same virtually in any language
(Python was chosen because I wanted to write an XBMC add-on and XBMC
add-ons are only written in Python).
If you prefer Java, I have the same player made for Android, check out the
code here: svn://svn.online.bg/android-icecast-player (an Eclipse project)
and see a description here: http://bilbo.online.bg/~assen/icecast-android .
It does not differ much, but uses Android's built-in player. It only uses
SQLite (no plain-text storage). The biggest non-Icecast feature here is the
circle menu, which was custom built for the project.
WWell,
Assen
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://lists.xiph.org/pipermail/icecast-dev/attachments/20120829/aeec123f/attachment-0001.htm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: example.py
Type: application/octet-stream
Size: 1388 bytes
Desc: not available
Url :
http://lists.xiph.org/pipermail/icecast-dev/attachments/20120829/aeec123f/attachment-0001.obj