Hi,
I'm wondering if there's a way to use a predicate expression as a boolean
in an if-then-elsif-... expression.

What I'm trying to do is to set metadata on a input stream based on a
published schedule where the feed provider doesn't set metadata.  I also
don't want to set up a multitude of exec_at schedules, one for each hour or
half-hour and feed, each with its own predicate, thinking that the overhead
of a single exec_at and one if-then-else for each feed (there are three in
my case) would be more efficient.

However, this doesn't compile complaining that it is expecting a bool
instead of the ()->_ which it sees there at the predicate clause.

I don't even know if I have the syntax correct for the fst(insert_metadata)
function, so if that looks wrong, some help on that usage would be
appreciated also.

e.g.:

p_feed = insert_metadata(id="Feed Name", audio_to_stereo( input.http(id="feed",
max=20., "http://feed_server/url";)))

feed = snd(p_feed)
feed_setmetadata = fst(p_feed)


def set_metadata()

if { 00h } then
    feed_setmetadata( [ ( "artist", "Network" ), ("title", "Show 1") ] )
elsif { 01h } then
    feed_setmetadata( [ ( "artist", "Network" ), ("title", "Show 2") ] )
elsif { 02h } then
    feed_setmetadata( [ ( "artist", "Network" ), ("title", "Show 3") ] )
elsif { 03h00m-03h29m } then
    feed_setmetadata( [ ( "artist", "Network" ), ("title", "Show 4") ] )
elsif { 03h30m-03h59m } then
    feed_setmetadata( [ ( "artist", "Network" ), ("title", "Show 5") ] )
elsif { 04h00m-05h29m } then
    feed_setmetadata( [ ( "artist", "Network" ), ("title", "Show 6") ] )
elsif { 04h30m-05h59m } then
    feed_setmetadata( [ ( "artist", "Network" ), ("title", "Show 7") ] )
#... for each hour in the day
else
feed_setmetadata( [ ( "artist", "Network" ), ("title", "") ] )
    end

end



exec_at(freq=60., pred=true, set_metadata)

#...
# feed then sent to an output.icecast
#

Thanks!
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to