Hi Romain,

Thanks, I did find I had to add mksafe(Fall) for it to work, but with your suggestions I got it to work.

Now to do the hard part :)

Chris

On 11/13/19 1:07 AM, Romain Beauxis wrote:
Hi Chris,

This is a syntax issue. Let's add some space to your code so I can show you:

radio = fallback([
  # Switch begins
  switch([
     ({ 1w },monday),
     ({ 2w },tuesday),
     ({ 3w }, wednesday),
     ({ 4w }, thursday),
     ({ 5w }, friday),
    ({ 6w }, saturday),
    ({ 7w }, sunday)
]), # Switch ends
Fall]) # Back at the fallback

Previously, Fall was part of the list of switch elements, which are supposed to be pairs and not just a source: that was your error messages.

Good indentation helps making the code readable but also, it's usually good to split things so as to avoid nested code. For instance, here:

# First the switch
s =   switch([
     ({ 1w },monday),
     ({ 2w },tuesday),
     ({ 3w }, wednesday),
     ({ 4w }, thursday),
     ({ 5w }, friday),
    ({ 6w }, saturday),
    ({ 7w }, sunday)
])

# Then the fallback:
radio = fallback([s,Fall])

Also, you might want to be aware of the `track_sensitive` parameter for switch and fallback, in the case where you'd expect the transition to happen right away and not after the end of the current track.

Hope this helps!
Romain



Le lun. 11 nov. 2019 à 09:21, Chris Moody <des...@playbox.tech> a écrit :

    Hi all,

    I'm trying to get my first LiquidSoap script to work and not sure
    what
    the issue is. The script I generated mainly looking at the Cookbook
    online is:

    > #!/usr/bin/liquidsoap
    >
    > #DOWs feeds
    > monday = playlist(mode="normal", "~/radio/playlist/monday.m3u")
    > tuesday = playlist(mode="normal","~/radio/playlist/tuesday.m3u")
    > wednesday = playlist(mode="normal","~/radio/playlist/wednesday.m3u")
    > thursday = playlist(mode="normal","~/radio/playlist/thursday.m3u")
    > friday = playlist(mode="normal","~/radio/playlist/friday.m3u")
    > saturday = playlist(mode="normal","~/radio/playlist/saturday.m3u")
    > sunday = playlist(mode="normal","~/radio/playlist/sunday.m3u")
    >
    > #Fallback playback, if for some reason the DOW can't play.
    > Fall = single("~/radio/fallback.mp3")
    >
    > #what to play based on the DOW
    > radio = fallback([ switch([
    >                             ({ 1w },monday),
    >                             ({ 2w },tuesday),
    >                             ({ 3w }, wednesday),
    >                             ({ 4w }, thursday),
    >                             ({ 5w }, friday),
    >                             ({ 6w }, saturday),
    >                             ({ 7w }, sunday),
    >             Fall])])
    >
    
output.icecast(%mp3,host="localhost",port=8000,password="hackme",mount="/radio",radio)

    I've installed LiquidSoap on to my Ubuntu workstation and this
    generates
    the following:

    > At line 24, char 17:
    >   this value has type
    >     source(_) (inferred at line 13, char 14-37)
    >   but it should be a subtype of (the type of the value at line 23,
    > char 29-44)
    >     (_*_)

    Line 24, is the line that says "Fall])])" character 17 is the first ]

    Any help on what the issue is, and how to fix it would be greatly
    appreciated!

    Chris



    _______________________________________________
    Savonet-users mailing list
    Savonet-users@lists.sourceforge.net
    <mailto:Savonet-users@lists.sourceforge.net>
    https://lists.sourceforge.net/lists/listinfo/savonet-users



_______________________________________________
Savonet-users mailing list
Savonet-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/savonet-users
_______________________________________________
Savonet-users mailing list
Savonet-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to