James McCurrach
2004-Sep-07 06:24 UTC
[Icecast] Ices with perl playlist - multiple instances
Hello, I'd like to be able to run multiple instances of Ices (2.0), each with their own playlist and streaming to different mountpoints. Although I'm relatively new to Ices and Icecast, so far I have had little trouble getting it running with two or more instances of Ices feeding off fixed playlists (files). I'd like to be able to set each instance of Ices to run with script based playlists (there are plenty of perl modules etc which do this well), with the playlist itself in the form of a table in a MySQL database. viz: mount #1 mount #2 | | --------|------- icecast (2.0) --------|-------.............. as many channels as I want | | ices #1 ices #2 | | next file next file | | --------|--------.............. | perl script | MySQL table (file name) (stream #) (play order) The problem is that I can't see how to get Ices to send some form of parameter to the perl script so that it knows which instance is calling it and can then pull the right next track filename from the DB. There is the pidfile option in the config.xml, so that as I invoke each Ices instance I can capture the pid (for signalling etc) but how can I pass this pid or other identifier to the perl script? Apologies in advance if this has already been dealt with, but I couldn't find it in the archives. Thanks, James
Rolf Johansson
2004-Sep-12 10:50 UTC
[Icecast] Ices with perl playlist - multiple instances
"James McCurrach" <james@hawkley.net> writes:> The problem is that I can't see how to get Ices to send some form of > parameter to the perl script so that it knows which instance is calling > it and can then pull the right next track filename from the DB. There > is the pidfile option in the config.xml, so that as I invoke each Ices > instance I can capture the pid (for signalling etc) but how can I pass > this pid or other identifier to the perl script?As far as I know, the Perl script is started _with_ the iceS instance, so you'll have to have one script for each iceS instance. I don't know of any way of passing arguments from iceS to the script at run-time, that could simplify things. One other way is to have the "base" Perl scipt in base.pl or something, then call ices-channel-1.pl with channel variables in that one, and require() base.pl, and ices-channel-2.pl for another iceS channel, and so on. /Rolf
Andy Baxter
2004-Sep-12 13:28 UTC
[Icecast] Re: Ices with perl playlist - multiple instances
On Tue, 07 Sep 2004 14:22:24 +0100, James McCurrach wrote:> > Hello, > > I'd like to be able to run multiple instances of Ices (2.0), each with > their own playlist and streaming to different mountpoints. > > Although I'm relatively new to Ices and Icecast, so far I have had > little trouble getting it running with two or more instances of Ices > feeding off fixed playlists (files). > > I'd like to be able to set each instance of Ices to run with script > based playlists (there are plenty of perl modules etc which do this > well), with the playlist itself in the form of a table in a MySQL > database. > > viz: > > mount #1 mount #2 > | | > --------|------- > icecast (2.0) > --------|-------.............. as many channels as I want > | | > ices #1 ices #2 > | | > next file next file > | | > --------|--------.............. > | > perl script > | > MySQL table > (file name) > (stream #) > (play order) > > The problem is that I can't see how to get Ices to send some form of > parameter to the perl script so that it knows which instance is calling > it and can then pull the right next track filename from the DB. There > is the pidfile option in the config.xml, so that as I invoke each Ices > instance I can capture the pid (for signalling etc) but how can I pass > this pid or other identifier to the perl script? > > Apologies in advance if this has already been dealt with, but I couldn't > find it in the archives. > > Thanks, > > JamesIf the playlist script has been invoked by ices, then ices should be its parent process. You can find out the parent process of a given process from inside perl, if this helps. Or if there are only going to be a few instances of the script, run each one through a different symbolic link (ln -s), and then read the command line inside the perl script.