Romain,

To give you a recap for your records, here's what we got going!

First off, your solution worked beautifully! But keep in mind, 5 seconds is 
"way" too short, especially for a 400 MB file to prepare.

So here's my modified version, for using request.dynamic as our primary 
fallback stream (for the moment until an emergency playlist is setup)...

        radio = fallback(track_sensitive = false, 
[request.dynamic(default_duration=120., conservative=false, length=30., 
request), blank()])


Hopefully my assumptions here were taken into account of the default_duration. 
Assuming liquidsoap isn't perfect with length of tracks, I assumed every song 
is "at least" 120 seconds long. Honestly, nothing on our station is under 3 
minutes of length. This will give our request.dynamic 120 seconds (in case 
liquidsoap assumed 0 length), to still get that next request in. It's our 
responsibility to keep broken sets out of our rotation & archive, so I won't 
hold any burden on Liquidsoap to do all that.

I set it to 30 seconds length, so that gives plenty of time for the next song 
to load. And it did!

2009/09/10 04:14:44 [root:3] Broadcast starts up!
2009/09/10 04:14:44 [src_4440:3] Switch to src_4439.
2009/09/10 04:14:44 [decoder:3] Decoder MP3 chosed for 
"/home/nocturnal/tunes/_TODAY/7.today.mp3"
2009/09/10 04:14:44 [src_4438:3] Prepared 
"/home/nocturnal/tunes/_TODAY/7.today.mp3" -- RID 1
2009/09/10 04:14:44 [src_4440:3] Switch to src_4438 with transition.
2009/09/10 04:14:44 [src_4435:3] Prepared 
"/home/nocturnal/tunes/JINGLE/NFM-Jingle-20090904.mp3" -- RID 0
2009/09/10 04:14:54 [src_4435:3] Finished with 
"/home/nocturnal/tunes/JINGLE/NFM-Jingle-20090904.mp3"
2009/09/10 04:17:12 [server:3] New client: localhost
2009/09/10 04:17:38 [decoder:3] Decoder MP3 chosed for 
"/home/nocturnal/tunes/DJ/Gabriel-Setis/Tribute-to-Melody-Episode-38.mp3"


This worked beautifully!

Here's our full code, and thank you again for your help Romain. Apologies if I 
seemed a bit pushy or upset, you have no idea how stressful my experience has 
been so far. But mainly just due to me inexperience.

I was honestly willing to pull all my hair out to get this working because I 
know it works, and it works great for what we need! I had no doubt you guys 
could help us fix this :)



Here's the script: (hopefully someone else can use it), we'll send you a better 
one once it's 100% finalized..


# This is track_now.sh, where we will basically setup what to tell liquidsoap 
to play
# It's very basic, but you have 30 seconds before the track playing ends to 
update this file.
# You can turn this into a script (possibly a heavier load), or just have a 
script write to this file.
# Notes from Romain: make sure you chmod +x track_now.sh   for execute 
permissions

###############################################
# INCLUDED FILE:   track_now.sh
###############################################
# Contents
###############################################

echo "/path/to/file.mp3"




###############################################
# LIQUIDSOAP LIQ FILE
###############################################
# Contents
###############################################

set("log.file.path", "nfm.log")
set("server.telnet",true)


###############################################
# This is where you set the track_now.sh location
###############################################

def request () =
request.create(audio=true,list.nth(get_process_lines("/path/to/track_now.sh"),0))
end


###############################################
# This is to fade your jingle over the next track in track_now.sh
###############################################

def fade(jingles,s)
  fade_in = 12.
  fade_out = 10.
  start_next = 3.
  def fader(from,to)
    from = fade.out(duration=fade_out,from)
    to = fade.in(duration=fade_in,to)
    add(normalize=false,
        [ to,
          sequence([ jingles, fallback([]) ]),
          from ])
  end
  cross(duration=start_next,fader,s)
end


###############################################
# If you need Live, this hasn't been fully refined, but it's a start
# You will need some .sh files to work with this.
###############################################

live = input.http(id="live", buffer=10., 
                  autostart=false, "http://localhost:8000/live";)
live = insert_metadata(id="livemeta",clear_metadata(live))
live = strip_blank(length=10.,live)


###############################################
# Transitions & Jingle
###############################################

jingle =  normalize( single 
("/home/nocturnal/tunes/JINGLE/NFM-Jingle-20090904.mp3") )

###############################################
# Fallbacks 
###############################################

        radio = fallback(track_sensitive = false, 
[request.dynamic(default_duration=120., conservative=false, length=30., 
request), blank()])


###############################################
# This adds the fade() function between Jingle and Radio
###############################################

radio = fade(jingle,radio)


###############################################
# Outputs -- Go time!
###############################################

        output.icecast.vorbis (
          id="nfm-ogg", mount="/nfm.ogg", name="Nocturnal.FM",
          genre="Trance & Progressive", url="http://Nocturnal.FM";,
          host="localhost", port=****, password="****",
          description="Nocturnal.FM", quality=4.,
          radio)




Thanks!

Nathan






-----Original Message-----
From: Romain Beauxis [mailto:[email protected]] 
Sent: Wednesday, September 09, 2009 9:43 PM
To: Nathan Huebner
Cc: [email protected]
Subject: Re: [Savonet] #303: Large tracks take long to load

Le mercredi 9 septembre 2009 21:32:15, vous avez écrit :
> Liquidsoap says, ok I'll load this, and Oh since I see this is the main
>  fallback for receiving music, I'll go ahead and load it again! Now I have
>  two of the same track ready to play (...)..
> 
> I just need to know how to tell Liquidsoap what to load. I don't know SH
>  programming, I'm actually a pure PHP programmer. 

Ok, please apologize for my previous assumption then... 

>  But it's a real mystery
>  here what your software wants to receive, and how it should be received.
>  It's been a guessing game.

The thing is that liquidsoap wants to keep in advance a queue of some requests 
in order to make sure that it will always have something to play. Hence the 
two songs that you see on the initial startup.

Provided you have liquidsoap 0.9.1, you can however, use the new behaviour 
which will allow only one song to be requested at once. What you need is to 
do:
  request.dynamic(conservative=false, length=5., (...)

That way, liquidsoap will estimate the length of the current song and only 
query for a new one when there are 5 (estimated) seconds remaining. 

The reason for this being an estimation is because mp3 format, for instance, 
does not allow a reliable length computation, hence computing the total length 
needs the decoding of the whole song, which we want to avoid :)

> Once I can dynamically talk to liquidsoap using the request.create (without
>  every request being a duplicate, and without liquidsoap needing a new
>  fallback to facilitate it during this dynamic method), I'll add a fallback
>  playlist later. Right now I'm focusing on how to have full control over
>  liquidsoap using request.dynamic, so I can begin writing a scheduler in
>  PHP.

Ok. I hope that with the above settings, you should have the full control of 
the scheduling in liquidsoap. I wish you success in writing a scheduler in PHP 
:-)


Romain


------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to