was Re: access source from inside timeout function
ok ok I guess I didn't ask the correct way...let's try another way :-)
My schedule is quite basic:
Songs are played randomly from a directory. Jingles are combined with this.
A crossfade is add before the output. I control it with metadata
liq_start_next liq_fade_in,liq_fade_out so I can apply specific crossfade to
jingles and songs.
songs=playlist(...)
jingles=playlist(...)
jingles = map_metadata(
fun(m)->[("liq_next_start","1."),("liq_fade_in",".2") ,
("liq_fade_out","0.")],jingles)
s = rotate (weights = [1, 4],
[jingles, songs])
Some of the songs are too longs and I'd like to fade them out after 4min
and skip to the next one.
What I did so far:
Enabling duration calculation:
set("request.metadata_decoders.duration",true)
so I can add a timeout if the duration of the song is more than 4min15
(255s)
def chrono(m)
if float_of_string(m["duration"]) > 255. then
log("Timeout configured")
add_timeout(240.,skip_track)
else
log("Timeout not needed")
end
end
The timeout function:
def skip_trak()
ignore(server.execute("r.skip"))
(-1.)
end
It does what I am expexting if I don't use crossfade on the source
#s.crossfade(s)
out(s)
And of course those skip are not smooth at all. I realized as well I have a
jingle after every skip...
I'm looking for some advice . Anyone?
Thank you.
Alexis wrote:
> Hi,
>
> I've just started to use liquidsoap (== newbee)
>
> I would like my source to skip to next track after a certain amout of
> time. I've tried to use add_timeout() in this purpose but I can't figure
> out how I can access my source from there.
>
> Below my code :
>
> def chrono()
> print( "timeout")
> source.skip(s) # --> is it possible to access s from here?
> (-1.)
> end
> def newtrack(m)
> print( "new tack")
> add_timeout(2.,chrono)
> end
>
> s = playlist(...)
> s = on_track(newtrack,s)
>
> Thanks for your help.
>
>
>
------------------------------------------------------------------------------
> Dive into the World of Parallel Programming. The Go Parallel Website,
> sponsored by Intel and developed in partnership with Slashdot Media, is
> your hub for all things parallel software development, from weekly thought
> leadership blogs to news, videos, case studies, tutorials and more. Take a
> look and join the conversation now. http://goparallel.sourceforge.net/
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users