Le jeudi 14 janvier 2010 17:31:25, pedz a écrit :
> Hi guys
Hi !
> Romain asked me to post the specifications of the script we require for
> Push FM so a new script can be written to automate our station.
>
> We are currently on 0.3.8.1 on an Gentoo box but would like to get that
> updated to 0.9.2
Good !
Before going into full details about your script, I would like to highlight
some important notions:
I believe the part about DJs harbor input is ok in the original script you
provided.
This reads:
8<-------------------------------------------------->8
stream0002 = input.harbor("/dj0002")
stream0204 = input.harbor("/dj0204")
stream0406 = input.harbor("/dj0406")
stream0608 = input.harbor("/dj0608")
(...)
remotestream =
switch(track_sensitive=false,
[ ({ 00h1m20s-02h}, stream0002),
({ 02h1m20s-04h}, stream0204),
({ 04h1m20s-06h}, stream0406),
(...)
])
8<-------------------------------------------------->8
(I don't understand why the original script used so many fallbacks..)
I have added "track_sensitive=false" to the switch. This will make sure
that if a DJ stays online after its scheduled time, the switch to the
next show still happen. However, this may result in an abrupt transition.
A way to circumvent this is to use transitions, but this is another topic
for now...
About the prerecorded show, the delicate issue is to make sure the
source always plays a fresh file. Indeed, liquidsoap sources try to queue
songs in advance in order to be available as much as possible. Hence,
even if a DJ has uploaded a new file, the old one may still be queued.
A simple way to solve this could be to use the "reload" server function that
has been added to the playlist sources. For instance:
8<-------------------------------------------------->8
# A playlist source for DJ #1:
dj1_playlist =
playlist(id="dj1_playlist","/home/push/audio/dj_music/monday0002_test")
8<-------------------------------------------------->8
Then, if you activate the telnet server, there will be a "dj1_playlist.reload"
command.
Hence, every time the DJ upload a file, you should also use this command to make
sure the playlist is reloaded. I believe this could be automatised in different
ways, such
as using a regular cron script, or through the FTP server..
Then, you should combine all the playlists in a switch, just as you did:
8<-------------------------------------------------->8
prerec = switch( track_sensitive=false,
[ ({ 1w0h1m21s-1w2h}, monday00),
({ 1w2h1m21s-1w4h}, monday02),
({ 1w4h1m21s-1w6h}, monday04),
({ 1w6h1m21s-1w8h}, monday06),
({ 1w8h1m21s-1w9h}, monday08),
({ 1w10h1m21s-1w12h }, monday10),
({ 1w12h1m21s-1w14h}, monday12),
({ 1w14h1m21s-1w16h}, monday14),
({ 1w16h1m21s-1w18h}, monday16),
({ 1w18h1m21s-1w20h}, monday18),
({ 1w20h1m21s-1w22h}, monday20),
(...)])
8<-------------------------------------------------->8
The section about random mixes worked ok in your previous script so I won't
comment on it.
About the ads, since the playlists are automatically generated, you may have
the same issue
as for pre-recorded shows. Hence, I would advise to use also the "reload"
command
each time the playlist is re-generated.
Combining the ads in a switch is a good idea, in particular it makes sure that
they are
available only during the 1m20 you want them to play. Hence the following code:
8<-------------------------------------------------->8
ads = switch([
({00h00m00s-00h01m20s or
02h00m00s-02h01m20s or
04h00m00s-04h01m20s or
06h00m00s-06h01m20s or
(...)
22h00m00s-22h01m20s}, adstartNendJing)
])
8<-------------------------------------------------->8
Now, you may combine these 3 sources. I am not sure that you should put the
pre-recorded
show first. If the DJ does not connect to harbor, then the prerec show will be
played anyway.
I also think the ads should be added to this fallback.
So perhaps it could be:
8<-------------------------------------------------->8
combined =
fallback( track_sensitive=false,
[ ads, remotestream, prerec, mixes])
8<-------------------------------------------------->8
If you look at the timings, the remotestream may be used immediatly
after the ads. If no remote stream is available after one minute, then the
pre-recorded
show is isued. Eventually, the mixes cover the case when none of them is
available.
Again here the "track_sensitive=false" may result in abrupt transitions.
This can be mitigated, again, using a custom transitions.
Then, using normalize is quite simple:
8<-------------------------------------------------->8
normalized = normalize(combined)
8<-------------------------------------------------->8
However, you should be aware that the normalize algorithm cannot predict the
future.
for this reason, if the stream has a sudden change in volume, the normalize
algorithm
may behave strangely.
Eventually, you push all of this to the icecast source:
8<-------------------------------------------------->8
output.icecast.mp3(id="output", fallible=true, normalized)
8<-------------------------------------------------->8
As you can see, I have added the parameter "fallible=true". This parameter
is new in 0.9.2 and allow an output to stop when the source is no longer
available. This way, you don't need to shutdown and restart liquidsoap, the
output will simply stop and restart once it is available again.. !
I let you read all of this, please let me know if you have other questions.
I have not tested all the code here, but I believe most of it should be correct
:-)
Romain
------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users