This is what my hobby projects looks like now. I tried to annotate it, but I was too lazy to polish it. Maybe somebody could use ideas, or maybe it could be fun for the developers to see what people are doing with liquidsoap.
# This script streams to mustafejen.se and also # to a channel on a deep web station. # It's mainly ripped from tutorials and some parts # are from other peoples scripts mentioned on the # mailing list, some parts are added from advice # and some things are figured out by reading the # API, using imagination and testing. # Below some code which makes me able to modify the streams # over the network. set("server.socket",true) set("server.socket.path","/home/per/webradio/liquidsoap/socket") set("server.socket.permissions",440) set("server.timeout",-1.) # Below some things which will hopefully help encrypting the incoming # streams in the future. All source clients are not prepared for this # yet, but there is ongoing work. If you can't wait for the source # client developers, maybe it's worth a try to route the incoming # streams through ssh (secure shell) tunnels. # # something like "ssh -N -T -L 8000:localhost:8000 my.server.org" # and the connect the source client to port 8000 on localhost set("harbor.ssl.certificate","/home/per/liquidsoap-daemon/certs/cert.pem") set("harbor.ssl.private_key","/home/per/liquidsoap-daemon/certs/privkey.pem") # First find a single file which will be used when the other sources of sound fail: default = single("/home/per/ustiusti.ogg") # Read raw sound input from a named pipe: tomtetest = input.external(id="tomtetest", "dd if=/home/per/tomtetest bs=16k 2>/dev/null") ##tomtetest = input.external(id="tomtetest", "dd if=/home/per/tomtetest 2>/dev/null") # Below is an option to read input from a jack source ## knark = input.jack(id="liquidsoap", clock_safe=false) # Add a live source. I have a mono microphone, so I convert it to stereo. # If your live source is stereo, you won't need the audio_to_stereo trick. live = audio_to_stereo(input.harbor(id="live", replay_metadata=true, "test.ogg", port=8081, password="james_bond", buffer=1.0)) #live = audio_to_stereo(input.harbor.ssl(id="live", replay_metadata=true, "test.ogg", port=8082, password="james_bond", buffer=1.0)) jive = amplify(4.0, live) jive = server.insert_metadata(id="jive", jive) # Add a live (encrypted) source. I have a mono microphone, so I convert it to stereo. # If your live source is stereo, you won't need the audio_to_stereo trick. evil = audio_to_stereo(input.harbor.ssl(id="evil", replay_metadata=true, "tset.ogg", port=8082, password="james_bond", buffer=1.0)) #evil = audio_to_stereo(input.harbor(id="evil", replay_metadata=true, "tset.ogg", port=8081, password="james_bond", buffer=1.0)) ejiv = amplify(4.0, evil) ejiv = server.insert_metadata(id="ejiv", ejiv) # Below my plans to connect bums and gypsies to the stream. # Add bakfickan bakfickan1 = audio_to_stereo(input.harbor(id="bakfickan1", "bakfickan1.opus", port=8081, password="james_bond", buffer=1.0)) #bakfickan1 = audio_to_stereo(input.harbor.ssl(id="bakfickan1", "bakfickan1.opus", port=8082, password="james_bond", buffer=1.0)) bakfickan2 = audio_to_stereo(input.harbor(id="bakfickan2", "bakfickan2.opus", port=8081, password="james_bond", buffer=1.0)) #bakfickan2 = audio_to_stereo(input.harbor.ssl(id="bakfickan2", "bakfickan2.opus", port=8082, password="james_bond", buffer=1.0)) bakfickan3 = audio_to_stereo(input.harbor(id="bakfickan3", "bakfickan3.opus", port=8081, password="james_bond", buffer=1.0)) #bakfickan3 = audio_to_stereo(input.harbor.ssl(id="bakfickan3", "bakfickan3.opus", port=8082, password="james_bond", buffer=1.0)) bakfickan4 = audio_to_stereo(input.harbor(id="bakfickan4", "bakfickan4.opus", port=8081, password="james_bond", buffer=1.0)) #bakfickan4 = audio_to_stereo(input.harbor.ssl(id="bakfickan4", "bakfickan4.opus", port=8082, password="james_bond", buffer=1.0)) hakfickan = add([bakfickan1, bakfickan2, bakfickan3, bakfickan4]) bakfickan = amplify(4.0, hakfickan) # I tried to add an internet escort voice to the stream. I don't know if she is streaming, or if she is a chinese SPAM company. # Add Maxine(?) maxine = amplify(4.0, audio_to_stereo(input.harbor(id="maxine", user="maxine", "maxine.opus", port=8081, password="james_bond", buffer=1.0))) #maxine = amplify(4.0, audio_to_stereo(input.harbor.ssl(id="maxine", "maxine.opus", port=8082, password="james_bond", buffer=1.0))) # AK. I would not mind him interrupting the pirated music with his jive. # Add AK ak = amplify(4.0, audio_to_stereo(input.harbor(id="ak", user="ak", "ak.opus", port=8081, password="james_bond", buffer=1.0))) #ak = amplify(4.0, audio_to_stereo(input.harbor.ssl(id="ak", "ak.opus", port=8082, password="james_bond", buffer=1.0))) # Berghem has kids and not so much time to stream, but knows how to do it. # Add Berghem berghem = amplify(4.0, audio_to_stereo(input.harbor(id="bergehem", user="berghem", "berghem.ogg", port=8081, password="james_bond", buffer=1.0))) #berghem = amplify(4.0, audio_to_stereo(input.harbor.ssl(id="bergehem", "berghem.ogg", port=8082, password="james_bond", buffer=1.0))) # Add a playlist hay = playlist("/home/per/Musik/haylist.txt") # You can also add another playlist (or many playlists) ## gray = playlist(reload=600,"/home/per/Musik/prat/svammel.txt") # Add some sources from the internet. The output.dummy I added # because it seemed to remove som log file messages which I did # not think I needed at the time of commenting this script. kpfa = input.http(max=30.0, buffer=20.0, "http://mustafejen.se:8000/kpfa_64") output.dummy(fallible=true, kpfa) sjrpt = input.http(max=30.0, buffer=20.0, "http://http-live.sr.se/p1-aac-96") output.dummy(fallible=true, sjrpt) # Add a second mono sound file, convert it to stereo # and amplify it. dorn = single("/home/per/Musik/prat/norn.ogg") norn = audio_to_stereo(dorn) porn = amplify(2.0, norn) # Create a source which plays (without letting tracks finish): # First the raw sound input from the named pipe radio = fallback(track_sensitive=false,[ (tomtetest), # If there is no input on the named pipe, play the jack source # if it is commented out and has input ## (knark), # If there is no input on the jack source, first play the second # mono file and switch to the second source from the internet # at the times mentioned in the switch regardless if the track # is finished or not. When the time is out for kpfa ... switch(track_sensitive=false, [({3w8h58m-3w8h59m}, porn), ({3w8h59m-3w10h31m}, kpfa)]), switch(track_sensitive=false, [({5h55m5s-6h10s}, sjrpt)]), # ... we turn on the first playlist defined which you will # find if you scroll up in the script. In case the sources # in the switch above are not available, the script would # probably have moved on to try the playlist anyway. (hay), # In case the playlist doesn't work for some reason play # the single file we defined first in the script. (default)]) # Below some cruft ## radio = random(weights=[5,1],[ radio, gray ]) # Create the source which will output to icecast # further down in the script. This source will first # attempt to play the live input I coverted to mono, # then it will try the procedure starting above # named "radio". # Temporary 1 #jingle = playlist("/tmp/jingle.txt") full = fallback(track_sensitive=false, [bakfickan, maxine, ak, berghem, jive, ejiv, request.queue(id="request"), radio]) # Temporary 2 #dull = random(weights=[1,5],[jingle, full]) # Below is a way to publish icecast streams # on http://flows.liquidsoap.info/ # This doesn't seem to work right now, # maybe it's deprecated but at least it # produces no error messages. Use at own risk. full = register_flow( radio="mustafejen", website="http://mustafejen.se/", description="Stream from Ersboda", genre="Eclectic", # streams=[("ogg/128k","http://mustafejen.se:8000/stream.ogg"), # streams=[("fdkaac/64k","http://mustafejen.se:8000/feting"), streams= [("opus/32k","http://mustafejen.se:8000/stream.opus"), ("mp3/128k","http://mustafejen.se:8000/feting")], full) # It used to be possible to scrobble on last.fm, # maybe it still is but I have commented it out. ## full = audioscrobbler.submit.full( ## user="kaptensnus", ## password="james_bond", ## full) # Finally output the source named "full" described a bit # up in this script. It will be output to icecast in various # formats. Some outputs I don't use are commented out. #output.icecast(%mp3(bitrate=128, stereo=true, samplerate=48000), #host="mustafejen.se", #port=8000, #password="james_bond", #mount="feting", #description="Stream from Ersboda", #genre="Alternative, eclectic", #url="https://mustafejen.se/~per", #name="mustafejen mp3", #public=true, #full) # output.icecast( # %mp3(bitrate=128, stereo=true), # mount="listen.mp3", # host="shaincast.caster.fm", # port=19514, # user="source", # password="james_bond", # name="zonnic", # full) #output.icecast(%vorbis(quality=0.4 , samplerate=48000, channels=2), #host="mustafejen.se", #port=8443, #password="james_bond", #mount="stream.ogg", #description="Stream from Ersboda", #genre="Alternative, eclectic", #url="https://mustafejen.se/~per", #name="mustafejen vorbis", #public=true, #protocol="https", #full) #output.icecast(%opus(vbr="none", bitrate=32, samplerate=48000, channels=2), #host="mustafejen.se", #port=8000, #password="james_bond", #mount="stream.opus", #description="Stream from Ersboda", #genre="Alternative, eclectic", #url="https://mustafejen.se/~per", #name="mustafejen opus", #public=true, #full) #output.icecast(%fdkaac(bitrate=64, transmux="adts", channels=2, samplerate=48000, aot="mpeg4_he_aac_v2", afterburner=false, sbr_mode=false), #host="mustafejen.se", #port=8443, #password="james_bond", #mount="feting", #description="Stream from Ersboda", #genre="Alternative", #url="https://mustafejen.se/~per", #name="mustafejen", #public=true, #protocol="https", #full) # Vorbis stream to onion site output.external(id="Tor", fallible=true, reopen_delay=3.0, %vorbis(quality=0.4 , samplerate=48000, channels=2), "/usr/bin/torsocks /usr/bin/oggfwd -n JamesBond -d 'Top_secret_project' superdupersecret.onion 8000 x-files /mount.ogg", mksafe(buffer(full))) #output.external(id="Tor", fallible=true, reopen_delay=3.0, %ogg(%opus(vbr="none", bitrate=32, samplerate=48000, channels=2)), #"/usr/bin/torsocks /usr/bin/oggfwd -n JamesBond -d 'Top_secret_project' superdupersecret.onion 8000 x-files /mount.ogg", #mksafe(buffer(full))) #### #### # New part of the script # # Below is the web radio station source # for the homeless music community "Verket" # In case you have come so far, it's # similar to the stuff above, and you will # probably be able to reverse engineer it # by looking at documentation on the page below: # https://www.liquidsoap.info/ default = single("/home/per/Musik/verket/Instängd/03-instangd-kott_ar_mord.mp3") lista = playlist("/home/per/playlist.txt") # Play user requests if there are any, # otherwise one of our playlists, # and the default file if anything goes wrong. radio = fallback([ (lista), (default)]) # Add the ability to relay live shows live = input.http(max=30.0, buffer=20.0, "http://mustafejen.se:8000/verketlive.ogg") hive = audio_to_stereo(live) verket = fallback(track_sensitive=false, [(hive), (radio)]) verket = register_flow( radio="Verket", website="http://verketumea.se/", description="Bands from Verket", genre="Mainly Punk", streams=[("mp3/128k", "http://mustafejen.se:8000/verket"), ("opus/64k", "http://mustafejen.se:8000/verket.opus")], verket) # Output to FLAC file # output.file(id="inspelning", fallible=true, %flac(channels=2, bits_per_sample=16, samplerate=48000, compression=5), "/home/per/Musik/live/verket/dump.ogg", hive) # Output to vorbis file # output.file(id="inspelning", fallible=true, %vorbis(quality=1.0 , samplerate=48000, channels=2), "/home/per/Musik/live/verket/dump.ogg", hive) # Output to OPUS and MP3 #clock.assign_new(sync=false,[output.icecast( #%mp3(bitrate=128, samplerate=48000, stereo=true), #mount="verket", #host="mustafejen.se", #port=8000, #user="source", #public=true, #genre="Mainly Punk", #url="http://verketumea.se", #password="james_bond", #description="Bands from Verket", #name="Verket mp3", #verket)]) #output.icecast(%fdkaac(bitrate=64, transmux="adts", channels=2, samplerate=48000, aot="mpeg4_he_aac_v2", afterburner=false, sbr_mode=false), #host="mustafejen.se", #port=8443, #password="james_bond", #mount="verket", #description="Bands from Verket", #genre="Mainly Punk", #url="http://verketumea.se", #name="Verket" #protocol="https",, #verket) output.icecast(%opus(bitrate=64, samplerate=48000, channels=2), host="mustafejen.se", port=8000, password="james_bond", mount="verket.opus", description="Bands from Verket", public=true, genre="Mainly Punk", url="http://verketumea.se", name="Verket opus", verket) #output.icecast(%vorbis(quality=0.4 , samplerate=48000, channels=2), #host="mustafejen.se", #port=8000, #password="james_bond", #mount="verket.ogg", #description="Bands from Verket", #public=true, #genre="Mainly Punk", #url="http://verketumea.se", #name="Verket vorbis", #verket) output.dummy(fallible=true, live) ### Dark Sonnets ### omdetpajar = single("/home/per/Musik/diverse/Korla Pandit - Miserlou.opus") grus = playlist("/home/per/webradio/ezstream/dauslista.txt") # Play order ordning = fallback([ (grus), (omdetpajar)]) sive = input.http(max=30.0, buffer=20.0, "http://mustafejen.se:8000/darkson.ogg") dive = audio_to_stereo(sive) darkson = fallback(track_sensitive=false, [dive, ordning]) # Output to FLAC file # output.file(%flac(channels=2, bits_per_sample=16, samplerate=48000, compression=5), "/home/per/Musik/live/darkson/dump-darkson.ogg", fallible=true, dive) # Output to vorbis file # output.file(id="dinspelning", fallible=true,%vorbis(quality=1.0 , samplerate=48000, channels=2), "/home/per/Musik/live/darkson/dump-darkson.ogg", dive) # Output icecast in aac format clock.assign_new(sync=false,[output.icecast(%fdkaac(bitrate=64, transmux="adts", channels=2, samplerate=48000, aot="mpeg4_he_aac_v2", afterburner=false, sbr_mode=false), host="mustafejen.se", port=8000, password="james_bond", mount="darkson", description="Dark Sonnets", genre="Various", url="Vet ej vilken hemsida", name="Dark Sonnet aac", darkson)]) # Output to icecast in opus format output.icecast(%opus(bitrate=64, samplerate=48000, channels=2), host="mustafejen.se", port=8000, password="james_bond", mount="darkson.opus", description="Dark Sonnets", public=true, genre="Various", url="Vet ej vilken hemsida", name="Dark Sonnet opus", darkson) output.dummy(fallible=true, sive) #output.dummy(blank()) _______________________________________________ Savonet-users mailing list Savonet-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/savonet-users