Thanks Ken,
I am not sure if you are using a different type of source, or if it is a
new feature in 1.1 (I am using 1.0.1), but I do not see a telet command
SOURCE.NEXT
But my real problem is that I want to do this INSIDE a LiquidSoap script.
So I would sort of like to see the code that SOURCE.STATUS uses to provide
the information so that I can clone it to my code.
Nick
On Sun, Nov 8, 2015 at 6:45 PM, Ken Restivo <[email protected]> wrote:
> I did the following (in Python):
>
> def get_archive(host, port, sourcename):
> try:
> s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
> s.connect ((host, port))
> s.sendall(sourcename + '.next\nquit\n')
> data = s.recv(8124).decode('utf-8', 'ignore').encode('utf-8')
> s.close()
> fname=' '.join([l for l in data.split('\n') if
> l.count('[playing]')][0].split(' ')[1:])
> return re.sub(r"-\d+kbps", "",
> fname.split("/")[-1].replace("unknown-","").replace(".ogg","").replace(".mp3",""))
> except:
> pass
>
>
> If you call it get_archive("localhost", 1234, "sourcename") it'll return
> the track playing only if it is playing.
>
> If you have only one playlist, use that for sourcename. Otherwise, you
> could loop through all the sources, and check them individually; only the
> ones that are playing will return non-Null.
>
> -ken
> --
> ------
> On Tue, Oct 20, 2015 at 07:33:52PM -0400, Nicholas Vrtis wrote:
> > Using Verion 1.0.1
> >
> > How do I tell if a source is actually playing?
> >
> > I have a LiquidSoap script where I have created a couple of new Telnet
> > server commands.
> >
> > Amoung other information, I would like to return whether a source is
> > currently playing.
> >
> > There is a Telnet Server command <source>.status which will tell me if
> the
> > source is started or stopped.
> >
> > I would like to be able to include the code to determine the same
> > information in my LIquidSoap code.
> >
> >
> > Thanks. Nick
>
> >
> ------------------------------------------------------------------------------
>
> > _______________________________________________
> > Savonet-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/savonet-users
>
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Savonet-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/savonet-users
>
------------------------------------------------------------------------------
Presto, an open source distributed SQL query engine for big data, initially
developed by Facebook, enables you to easily query your data on Hadoop in a
more interactive manner. Teradata is also now providing full enterprise
support for Presto. Download a free open source copy now.
http://pubads.g.doubleclick.net/gampad/clk?id=250295911&iu=/4140
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users