Hi Daniel,

Sorry for the late reply, I've tried adding mksafe, but in that case the fallback doesn't work since it always sees the input.harbor as connected thanks to mksafe.

Here's my setup, maybe I could do the recording from an external script, but then how could I do the switch? I may have interruptions because the scripts does too many things so it's problem.

# Standard settings

set("log.file.path","/home/xt/LOG/radio.log")
set("log.stdout",false)
set("log.file",true)
set("server.telnet",true)

# Stream Settings

backup = playlist(reload=1,reload_mode="rounds",mode="randomize","/MUSIC/BACKUP")

# Jingles
jingles = playlist(reload=1,reload_mode="rounds",mode="randomize","/MUSIC/JINGLES")
jingles = nrj(jingles)
jingles = mksafe(jingles)

def send_meta(m) =
  ignore(system("ttytter -status=\"#np: " ^ m["artist"] ^ " - " ^ m["title"] ^ " / Listen @ http://xtradio.org\" > /dev/null 2>&1"))
end

# Live sources
dj = input.harbor("dj",port=8082,password="xxx",id="dj")
explicit = input.harbor("explicit",port=8082,password="xxx",id="explicit")
vdj = input.harbor("/",icy=true,port=8088,password="xxx",id="vdj")
podcast = input.harbor("podcast",port=8082,password="xxx",id="podcast")

dj = mksafe(dj)
explicit = mksafe(explicit)
vdj = mksafe(vdj)

radio = backup
radio = random(weights = [1, 5], [delay(1.,jingles), radio])
radio = skip_blank(radio)
radio = smart_crossfade(radio)
radio = strip_blank(radio)
radio = nrj(radio)
radio = mksafe(radio)
radio = amplify(1.,override="replay_gain",radio)
radio = register_flow(
  radio="XTRadio - We Love Music! Do You?!",
  website="http://xtradio.org/",
  description="XTRadio",
  genre="electronic",
  user="foo",
  password="bar",
  streams=[("mp3/192k","http://stream.xtradio.org:8080/live.m3u"),
        ("mp3/128k","http://stream.xtradio.org:8080/mp3.m3u"),
        ("aacplus/32k","http://stream.xtradio.org:8080/aac.m3u")],
  radio)

%include "liquidsoap_include.liq"
%include "liquidsoap_meta.liq"

radio = fallback(track_sensitive=false, [podcast,radio])
radio = fallback(track_sensitive=false, [dj,radio])
radio = fallback(track_sensitive=false, [explicit,radio])
radio = fallback(track_sensitive=false, [vdj,radio])

radio = on_metadata(send_meta, radio)
#dj = on_metadata(dj_meta, dj)

# Now output the stream to the local icecast server
output.icecast(%mp3(bitrate=192), host="localhost",port=8080,password="xxx",mount="live",url="XTRadio.ORG",
name="We Love MusiC! Do U?! - 192kbps/MP3/Stereo - http://XTRadio.ORG - Like us on http://fb.com/XTRadio.ORG ",radio)
output.icecast(%aacplus(bitrate=32),host="localhost",port=8080,password="xxx",mount="aac",url="XTRadio.ORG",
name="We Love MusiC! Do U?! - 32kbps/AAC+/Stereo - http://XTRadio.ORG - Like us on http://fb.com/XTRadio.ORG ",radio)
output.icecast(%mp3(bitrate=128), host="localhost",port=8080,password="xxx",mount="mp3",url="XTRadio.ORG",
name="We Love MusiC! Do U?! - 128kbps/MP3/Stereo - http://XTRadio.ORG - Like us on http://fb.com/XTRadio.ORG ",radio)

# Record the live shows.

output.file(
    %mp3(stereo=true, bitrate=192, samplerate=44100, id3v2=true),
    "/MUSIC/RECORDINGS/Live_Auto_Recording/vdj/%Y-%m-%d/XTRadio-Live-%Y-%m-%d-%H_%M_%S.mp3", fallible=true, perm=509,
    vdj
)

output.file(
    %mp3(stereo=true, bitrate=192, samplerate=44100, id3v2=true),
    "/MUSIC/RECORDINGS/Live_Auto_Recording/explicit/%Y-%m-%d/XTRadio-Live-%Y-%m-%d-%H_%M_%S.mp3", fallible=true, perm=509,
    explicit
)

output.file(
    %mp3(stereo=true, bitrate=192, samplerate=44100, id3v2=true),
    "/MUSIC/RECORDINGS/Live_Auto_Recording/dj/%Y-%m-%d/XTRadio-Live-%Y-%m-%d-%H_%M_%S.mp3", fallible=true, perm=509,
    dj
)


Best regards,
        Ákos Veres

_____________________________________________
http://akos.me - A little about me.


On Wed, Sep 25, 2013 at 1:46 PM, Daniel James <daniel.james@sourcefabric.org> wrote:
Hi Akos,
>     > The problem is that for some reason the live source that i'm streaming
>     > breaks up at a random interval and so liquidsoap drops the connection
>
>     Are you using mksafe on the live source?
>
> No, that would help?

As I understand it, mksafe prevents the source from failing even when
you get a disconnection from the streaming client. You still need to
make the client reconnect whenever this happens.

> How could I connect two liquidsoap scripts? Like how can I make the
> second script only trigger when the song changes for example?

I'm not sure, but this list is the right place to ask :-)

> Wouldn't
> that leave me in the same position as in having one liquidsoap script?

Maybe mksafe is needed on the recording script too.

Cheers!

Daniel