[Icecast] Check feed connected, active - IceCast 2.4.x
Philipp Schafft
lion at lion.leolix.org
Mon Apr 13 06:47:06 UTC 2015
reflum,
On Sun, 2015-04-12 at 23:50 +0000, Dean Sauer wrote:
> On Sat, 11 Apr 2015 07:03:16 +0000, Philipp Schafft wrote:
>
> > You can request /admin/stats.xml. That file will return the overall
> > server status including per source information. If the server returns
> > 200 with the expected XML document the server is up and running.
>
> Thanks, my pseudo code already determined that and the underlying issue.
>
> If I query the server on port 8000 and get 200, then its up/running...
>
> Now the sources...
>
>
> > You can
> > look at the <source> tags to find out if the sources are connected.
>
> Thanks, but no I am not scraping/parsing that. I despise the whole
> concept of "scraping" sites like this, there is already one piece of
> software doing this as it is in my arena.
I think you misunderstood me.
the admin/stats.xml file *is* the API interface. It's for usage such as
yours. within /admin: stuff ending with .xsl is for non-API, stuff with
no dot in the name or ending in .xml are for API usage.
What you will get is a well formed XML document. Have a look at it!
> doing a:
>
> urllib.urlopen("http://domain/source").getcode()
>
> just returns a 200 even if the actual source is down, and the source is
> on a fall back. If I were following http expectations I should get 302,
> temp redirection as used widely, or 307 if you stick to the strict
> standard.
No. I think you are misunderstanding the standard here:
Icecast is *not* refusing to serve the resource. So it MUST return a
2xx-status code. The fallback isn't happening in the protocol layer.
(This is because there are no mid-of-stream redirects on HTTP. So
redirects (3xx) can't work for users already connected.)
> Sadly right now the simple check that IceCast is UP will have to suffice,
> and covers the main problem, right now.
Again, see my hints on the admin/stats.xml file. It contains all the
data you want.
--
Philipp.
(Rah of PH2)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part
URL: <http://lists.xiph.org/pipermail/icecast/attachments/20150413/c0583c8e/attachment.sig>
More information about the Icecast
mailing list