Thanks for answer!
Here is full script:
-------------------------------------------
#!/usr/bin/env liquidsoap
set("init.daemon", true)
set("init.daemon.change_user", true)
set("init.daemon.change_user.user", "liquidsoap")
set("init.daemon.change_user.group", "liquidsoap")
set("server.telnet", true)
def stop_after_current =
raw_output = get_process_lines("./stop_after_current.py")
stop = list.hd(raw_output)
if stop == "true" then
{false}
else
{true}
end
end
live = input.harbor("live", port=8008, password="***",
metadata_charset="CP1251")
live2 = input.harbor("live2", port=8008, password="***",
metadata_charset="CP1251")
mlive = add([live, live2])
music = playlist(reload=3600, "/home/liquidsoap/files/music")
jingles = playlist(reload=86400, "/home/liquidsoap/files/jingles")
nonstop = smart_crossfade(mksafe(rotate(weights=[3, 1], [music, jingles])))
nonstop = switch(track_sensitive=false, [(stop_after_current, nonstop),
({true}, blank(id="", duration=20.0))])
stream = nrj(fallback(track_sensitive=false, [mlive, nonstop]))
out = output.icecast(host="live2.crazyradio.net", port=8000,
password="***", name="Rap Music", description="Rap-канал нашего
сумасшедшего радио =)", genre="Rap", url="http://crazyradio.net/",
encoding="UTF-8")
out(%mp3(bitrate=128), mount="128", stream)
out(%mp3(bitrate=96), mount="96", stream)
out(%mp3(bitrate=24), mount="24", stream)
-------------------------------------------
stop_after_current.py just print on stdin "true" or "false", where "true"
means we need to stop playlist after current track.
> However, even if your function returns true, it is possible that the
> nonstop source will not be played because it is not available..
On the contrary, nonstop always available, I can't get to play the silence.
The overall objective of this: I need to make the transition from the
nonstop to a dj more beautiful - when a song ends, without any
interruptions and circumcision connect a dj. It's possible, but then it's
difficult to guess, in what moment start broadcast, via telnet I can find
the time to the end of the track (128.remaining), but all the same, rarely
just get in the end, all the more, together with the crossfade. But if
after track will be quiet, you can later enable the translation, there will
be a slight pause, but will not circumcision track.
If I add a debug code to the function, i see, that stop_after_current calls
only once, at start.
P.S. Once again, sorry for English, I have used a translator.
2013/2/1 Romain Beauxis <[email protected]>
> Hi Azat!
>
> 2013/1/31 Azat Galiev <[email protected]>:
> > Hey, guys! Good day! I have a problem: I have function:
> >
> > def stop_after_current =
> > ...
> > end
> >
> > It's return a predicate ({true} or {false}). When it return a true, all
> > right, liquidsoap hasn't to do anything. But if it return a false, i
> need to
> > stop current playlist. So I write this code:
> >
> > nonstop = at(stop_after_current, nonstop)
> >
> > But it's work only once - on the start. If after some tracks function
> will
> > return false, it does not recognize this. Ok, so I write another code:
> >
> > nonstop = switch(track_sensitive=false, [(stop_after_current, nonstop),
> > ({true}, blank(id="", duration=20.0))])
> >
> > But It's doesn't work too! Despite track_sensitive! Ok, so I write code
> > again =)
> >
> > nonstop = fallback([request.queue("blank"), nonstop])
> >
> > Then via telnet I push file with silence. But it doesn't play!! Something
> > cuts the silence in the following code:
> >
> > nonstop = smart_crossfade(mksafe(rotate(weights=[3, 1], [music,
> jingles])))
> >
> > But what is the mistakes in the first and second variants? Thank you in
> > advance!
> >
> > P.S. Sorry for my English.
>
> No problem!
>
> Good try :-) I think this one was close to what you need:
>
> > nonstop = switch(track_sensitive=false, [(stop_after_current, nonstop),
> ({true}, blank(id="", duration=20.0))])
>
> However, even if your function returns true, it is possible that the
> nonstop source will not be played because it is not available..
>
> Would you mind sharing a bit more of your script, for instance a
> minimal script with an actual source for nonstop and perhaps a more
> detailed description of what you expect?
>
> Romain
>
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_jan
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users