OK,
I have made large progress on this and am reporting my findings in case
anyone else struggles with this in the future:
This code works but not reliably:
radiostream = switch ([
({ (!breakz == ["Break1 - "]) }, break1),
({ (!breakz == ["Break2 - "]) }, break2),
({ (!breakz == ["Break3 - "]) }, break3),
({ (!breakz == ["Break4 - "]) }, break4),
({ (true) }, stream)
])
This code seems to solve those reliability issues:
radiostream = stream
playbreaks = switch ([
({ (!breakz == ["Break1 - "]) }, break1),
({ (!breakz == ["Break2 - "]) }, break2),
({ (!breakz == ["Break3 - "]) }, break3),
({ (!breakz == ["Break4 - "]) }, break4)
])
radiostream = add([radiostream,playbreaks])
I have to do more testing and want to see if I can get better sounding
transitions, but I think this can work for me as is if need be.
Is the radiostream = add([radiostream,playbreaks]) functionality in the
official docs anywhere? If so, where?
On Thu, Feb 19, 2015 at 10:49 AM, drew Roberts <[email protected]> wrote:
> I have this working but not reliably.
>
> The guts of the thing is:
>
> # make a "variable" to switch on
> breakz = ref ["COOL"]
>
>
> # the main stream to play
> # this is an icecast server on the local lan
> stream = input.http("http://192.168.86.224:8002/rockriv.mp3")
>
> # set up some "playlists" currently just single files to switch to based
> on the "variable" above
> break1 = mksafe(single("/var/audio/traffic/break1.mp3"))
> break2 = mksafe(single("/var/audio/traffic/break2.mp3"))
> break3 = mksafe(single("/var/audio/traffic/break3.mp3"))
> break4 = mksafe(single("/var/audio/traffic/break4.mp3"))
>
> # set up a failover
> failover = mksafe(single("/var/audio/emergency/peepinyou128.mp3"))
>
>
> # the next section sets the "variable" above based on the metadata in the
> main stream above
> # the print statements are for testing. Can I put them in the switch
> statement itself?
>
> def f(x) =
> (snd(x))
> end
>
> def on_meta (meta)
>
> breakz := list.map(f,meta)
> print (!breakz)
> print (!breakz == ["Break1 - "])
> print (!breakz == ["Break2 - "])
> print (!breakz == ["Break3 - "])
> print (!breakz == ["Break4 - "])
> end
>
> # this next bit is what triggers the setting of the "variable" above when
> the metadata in stream
> # changes
> stream = on_metadata(on_meta, stream)
>
> # this next section is where the switch happens
> # radiostream is either a break playlist (single) if the "variable"
> indicates
> # or it is the main stream (music)
> radiostream = switch ([
> ({ (!breakz == ["Break1 - "]) }, break1),
> ({ (!breakz == ["Break2 - "]) }, break2),
> ({ (!breakz == ["Break3 - "]) }, break3),
> ({ (!breakz == ["Break4 - "]) }, break4),
> ({ (true) }, stream)
> ])
>
>
> There is a bit more, but this is the guts of it.
>
> It works. But not all the time.
>
> Sometimes, the switch plays the "playlist" indicated by the "variable" but
> other times I get silence. (I am not wanting to go to failover on this
> condition while testing, that is reserved for stream failure.)
>
> I did some testing with a friend last night and it got even more
> confusing / interesting.
>
> We set him up with a liquidsoap and pointed him at stream as well (via
> port forwarding)
>
> It worked for him too. But also unreliably as well. Here is the
> interesting though.
>
> Sometimes, when I got silence, his "break" played as it should have.
> Sometimes when he got silence, I got the correct "break" playing. Sometimes
> we both got the correct "break" playing... etc.
>
> How do I go about troubleshooting a switch that is behaving this way? Am I
> configuring something wrong? Is there something I can look for in the logs?
> Something else?
>
> all the best,
>
> drew
> --
> http://nakedghosts.blogspot.com/
>
--
http://nakedghosts.blogspot.com/
------------------------------------------------------------------------------
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