Well, after much reading, testing, frustration, etc. I am close. The
following seems to be working but not reliably.
##########
#!/usr/bin/liquidsoap
# rpimeta.liq
# The metadat (Cart Name) for the break will determine which playlist gets
played
# Seems to be sort of working As of Feb 14/2015
# Need to sort out reliability issues.
#as the last line before the:
# exit 0
# line
# Logging
# to get this to work, add the user pi to the liquidsoap group
# and sudo chmod 775 /var/log/liquidsoap/
# this will allow the logfile to be written.
set("log.syslog", true)
set("log.level",3)
set("log.syslog.facility","DAEMON")
set("log.syslog.program","liquidsoap")
set("server.telnet",true)
breakz = ref ["COOL"]
#specify the icecast stream as an input
stream = input.http("http://192.168.86.224:8002/rockriv.mp3")
# try some breaks
break1 = single("/var/audio/traffic/break1.mp3")
break2 = single("/var/audio/traffic/break2.mp3")
break3 = single("/var/audio/traffic/break3.mp3")
break4 = single("/var/audio/traffic/break4.mp3")
#specify the fail over file (could change this to be a template or
directory of files)
failover = mksafe(single("/var/audio/emergency/peepinyou128.mp3"))
def f(x) =
(snd(x))
end
def on_meta (meta)
breakz := list.map(f,meta)
$ these prints should be here just for testing
print (!breakz)
print (!breakz == ["Break1 - "])
print (!breakz == ["Break2 - "])
print (!breakz == ["Break3 - "])
print (!breakz == ["Break4 - "])
end
stream = on_metadata(on_meta, stream)
radiostream = switch ([
({ (!breakz == ["Break1 - "]) }, break1),
({ (!breakz == ["Break2 - "]) }, break2),
({ (!breakz == ["Break3 - "]) }, break3),
({ (!breakz == ["Break4 - "]) }, break4),
({ (true) }, stream)
])
#Specify what to switch to when silence is detected
radiostream = fallback(track_sensitive=false, [radiostream, failover])
# added to try keep stream checking metadata - not sure if or why needed
dummystream = fallback(track_sensitive=false, [stream, failover])
# Output to ALSA (the pi's audio)
output.alsa(device="hw:1,0", radiostream)
# try this to keep stream checking metadata
output.dummy(dummystream)
##########
Any hints?
all the best,
drew
On Thu, Feb 12, 2015 at 11:41 AM, unosonic <[email protected]> wrote:
>
> as a start, you could look into on_metadata:
>
> # this should do something reasonable, e.g. load a playlist etc.
> def my_function(m) =
> title = m["title"]
>
> if title == "something" then
> ...
> # Otherwise
> else
> ...
> end
> end
>
>
> icemeta = input.http(...)
> icemeta = on_metadata(my_function, icemeta)
>
>
> --u
>
> drew Roberts:
> > Not sure if this is currently possible or how to do it if it is.
> >
> > I am thinking it might be nice to have liquidsoap pull down an icecast
> > stream and play it to alsa. (I know how to do this.)
> >
> > Then, let it watch the metadata in the stream and if it sees "localshow1"
> > for instance, it would play the localshow1 playlist until the stream
> > metadata changed to something else, at this point, it would switch back
> to
> > the icecast stream unless the metadat was for another localshow. At some
> > point later, the metadata could become localshow2 and it would stop
> playing
> > the stream and play the localshow2 playlist.
> >
> > On stream failure, it should play a defined local playlist.
> >
> > Does anyone know if this is possible? Any hints or docs on how to do this
> > if it is possibly?
> >
> > all the best,
> >
> > drew
> > --
> > http://nakedghosts.blogspot.com/
>
> >
> ------------------------------------------------------------------------------
> > 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/
>
> > _______________________________________________
> > Savonet-users mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/savonet-users
>
>
>
> ------------------------------------------------------------------------------
> 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/
> _______________________________________________
> Savonet-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/savonet-users
>
--
http://nakedghosts.blogspot.com/
------------------------------------------------------------------------------
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/
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users