diff --git a/conf/jukebox.conf.bak b/conf/jukebox.conf.bak deleted file mode 100644 index d2e86c1..0000000 --- a/conf/jukebox.conf.bak +++ /dev/null @@ -1,3 +0,0 @@ -telnetaddr = "144.32.64.170" -sched_script = "/usr/local/www/myradio/src/Controllers/jukebox_sched.php" -tracklist_script = "/usr/local/bin/jukeboxtracklist.sh" diff --git a/fm-stl.liq.bak b/fm-stl.liq.bak deleted file mode 100644 index a5314b1..0000000 --- a/fm-stl.liq.bak +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/local/bin/liquidsoap -v - -# -# Send Audio to the FM transmitter through a totally unsuitable, stupid last-minute bodge -# - -set("init.daemon.pidfile.path", "/usr/local/var/run/liquidsoap/fm-stl.pid") -set("log.level",3) -set("log.stdout", true) -set("log.file", true) -set('log.file.path', '/usr/local/var/log/liquidsoap/fm-stl.pid') - -set("frame.audio.channels",2) -set("frame.audio.samplerate",48000) - -live = input.jack(id="fmOutput") -live = fallback([live,single("/jukebox/TechnicalDifficultiesVoice.mp3")]) - -output.srt(host="144.32.64.181", - port=18830, - %wav(stereo=true, channels=2, header=false), - buffer(live)) diff --git a/jukebox.liq.old b/jukebox.liq.old deleted file mode 100644 index 6e8923a..0000000 --- a/jukebox.liq.old +++ /dev/null @@ -1,149 +0,0 @@ -#!/usr/local/bin/liquidsoap -v - -# Coded by Gareth Lloyd -# & Lloyd Wallis -# & Andy Durant -# Launched on URY 2012-01-27 00:36 - -%include "conf/ice.conf" -%include "conf/jukebox.conf" - -set("init.daemon.pidfile.path", "/usr/local/var/run/liquidsoap/jukebox.pid") -set("log.stdout",true) -set("log.level",4) -set("server.telnet.bind_addr", telnetaddr) -set("server.telnet", true) -set("log.file", true) -set("log.file.path","/usr/local/var/log/liquidsoap/jukebox.log") -set("frame.audio.channels",2) -set("frame.audio.samplerate",48000) -#set("audio.converter.samplerate.libsamplerate.quality","best") -set("protocol.ffmpeg.replaygain",true) -enable_replaygain_metadata() - -# Local file if music filestore isn't -interludelong = mksafe(single("/jukebox/intermission-long.mp3")) -interludelong = crossfade(duration=2., fade_in=1.2, fade_out=1.2, interludelong) -techdiff = single("/jukebox/TechnicalDifficultiesVoice.mp3") -techlude = add([interludelong, switch([({0s}, techdiff)])]) - -# Playlists - used if MyRadio script breaks - -# Normal (Backup) playlist -backup_playlist = playlist(reload_mode="watch", "/jukebox/playlists/normal-list.pls", mime_type="application/xspf+xml") - -# Main requests queue from MyRadio Requests page -requests = request.queue(id="jukebox_requests") - - -def myradio_sched() = - # Get the first line of the response - result = list.hd(default="", get_process_lines(sched_script)) - # Create and return a request using this result - request.create(result) -end - -# The default track scheduler - obeys licence requirements -# and other funsies. -main = request.dynamic(id="jukebox_main", myradio_sched, timeout=15.0, length=30.0, conservative=false) - -def on_metadata_cb(meta) - log("on_metadata thinks now playing is " ^ meta["trackid"]) -end -main = on_metadata(on_metadata_cb, main) - -def on_offset_cb(_, meta) - log("on_offset(1) thinks now playing is " ^ meta["trackid"]) -end -main = on_offset(offset=1.0, on_offset_cb, main) - -def on_track_cb(meta) - log("on_track thinks now playing is " ^ meta["trackid"]) -end -main = on_track(on_track_cb, main) - -now_playing_id = ref "" -def update_now_playing(meta) - now_playing_id := meta["trackid"] -end -main = on_metadata(update_now_playing, main) - -def get_now_playing(_) - !now_playing_id -end -server.register("now_playing", get_now_playing) - -# Jingles every 12min~ish, not to coincide too often with the Jukebox ones below. -jingles = playlist(reload_mode="watch", "/jukebox/jingles") -jingles = delay(720. , jingles) -jingles = at({get_process_output(playjingles_script)=="true"}, jingles) - -# Campus Jukebox jingles every 30min -cjjingle = playlist(mode="randomize", reload=3600, "/jukebox/cj-jingles") -cjjingle = delay(1800., cjjingle) -cjjingle = at({get_process_output(playjingles_script)=="true"}, cjjingle) - -# Put all the pieces together -jukebox = fallback([cjjingle, jingles, requests, main, backup_playlist], replay_metadata = false) -jukebox = fallback(track_sensitive=false, [jukebox, techlude]) - -# Avoid too much blank/silence in tracks -jukebox = skip_blank(max_blank=3., jukebox) - -# Apply replay gain -jukebox = amplify(1.,override="replay_gain", jukebox) - -jukebox = amplify(0.3, jukebox) - -# Add in some crossfade -#jukebox = smart_crossfade(start_next=5., fade_in=3., fade_out=3., jukebox, conservative=true) -jukebox = crossfade(smart=true, duration=4., fade_in=2., fade_out=2., jukebox, conservative=true) - -# Tracklist trigger -last_tracklisted = ref "-1" -def trig_tracklist(j) = - if list.mem_assoc("trackid", j) then - log("Tracklist - recordid: " ^ j["recordid"] ^ "; trackid: " ^ j["trackid"]) - if j["trackid"] != !last_tracklisted then - ignore(system(tracklist_script ^ " " ^ j["recordid"] ^ " " ^ j["trackid"] )) - last_tracklisted := j["trackid"] - end - else - log("Tracklist - filename: " ^ j["filename"]) - ignore(system(tracklist_script ^ " " ^ j["filename"])) - #ignore("pfft!") - end -end -jukebox = on_metadata(trig_tracklist, jukebox) -#jukebox = on_offset(force=true, offset=3.0, trig_tracklist, jukebox) -#jukebox = on_track(trig_tracklist, jukebox) - -# Force Liq to separate Icecast metadata. -def update_meta(m) = - title = m["title"] - artist = m["artist"] - [("title","#{title}"),("artist","#{artist}")] -end - -jukebox = map_metadata(update_meta, mksafe(jukebox)) - -# Output to soundcards - -output.jack(id="jukebox", start=true, jukebox) - -# Icecast outputs use a seperate clock to remove lag from the HW output -clock.assign_new(id="jukeboxStream", -[ -output.icecast( - %mp3(bitrate=192, samplerate=48000, stereo=true), - host=icehost, - port=iceport, - password=icepass, - mount="jukebox", - url=website, - description=description, - name=name, - genre="Student Radio", - mksafe(buffer(jukebox)) -) -]) diff --git a/mattsat/mattsatpid b/mattsat/mattsatpid deleted file mode 100755 index e69de29..0000000 diff --git a/matttuner.liq.bak b/matttuner.liq.bak deleted file mode 100644 index e0d3015..0000000 --- a/matttuner.liq.bak +++ /dev/null @@ -1,33 +0,0 @@ -#!/usr/local/bin/liquidsoap -v - -%include "conf/ice.conf" -# -# Temporary -# -set("init.daemon.pidfile.path", "/usr/local/var/run/liquidsoap/studios.pid") -set("log.level",3) -set("log.stdout", true) -set("log.file", true) -set('log.file.path', '/usr/local/var/log/liquidsoap/studios.log') - -set("frame.audio.channels",2) -set("frame.audio.samplerate",48000) - -# Sources -fmoffair = input.jack(id="fmoffair") -fmoffair = amplify({ 2.0 },fmoffair) - -output.icecast( - %mp3(bitrate=192), - host=icehost, - port=iceport, - password=icepass, - mount="fm", - url=website, - description="Direct feed from Off-Air Fm Tuner " ^ description, - name="URY FM | " ^ name, - genre="Student Radio", - start=true, - mksafe(buffer(fmoffair)) - ) - diff --git a/news.liq b/news.liq deleted file mode 100644 index c19204c..0000000 --- a/news.liq +++ /dev/null @@ -1,63 +0,0 @@ -#!/usr/local/bin/liquidsoap -v - -# Bolted on by Matthew Stratford 2018 - -%include "conf/ice.conf" -#%include "conf/jukebox.conf" - -set("init.daemon.pidfile.path", "/usr/local/var/run/liquidsoap/news.pid") -set("log.stdout",true) -set("log.level",3) -set("log.file", true) -set("log.file.path","/usr/local/var/log/liquidsoap/news.log") - -set("frame.audio.channels",2) -set("frame.audio.samplerate",48000) - -# Sources -news = input.jack(id="news") -#techdiff = single("/jukebox/TechnicalDifficultiesVoice.mp3") -#news = playlist(reload_mode="watch", "/jukebox/jingles") - -# Bodge for the StratSat -news = audio_to_stereo(stereo.left(news)) - -def on_silence() = - ignore(system("/usr/local/etc/liquidsoap/scripts/dishy_boi.sh")) -end -news = on_blank(max_blank=180.0, start_blank=false, on_silence, news) - -news = amplify(1.5, news) - -output.jack(id="fakeNews", start=true, news) - -news2 = input.jack(id="news2") -news2 = amplify(1.5, news2) - -clock.assign_new(id="newsStream", -[output.icecast( - %mp3(bitrate=192, samplerate=48000, stereo=true), - host=icehost, - port=iceport, - password=icepass, - mount="news", - url=website, - description=description, - name="IRN/Sky News Feed | " ^ name, - genre="Student Radio", - start=true, - mksafe(buffer(news)))]) - -clock.assign_new(id="news2Stream", -[output.icecast( - %mp3(bitrate=192, samplerate=48000, stereo=true), - host=icehost, - port=iceport, - password=icepass, - mount="news2", - url=website, - description=description, - name="IRN 2 Feed | " ^ name, - genre="Student Radio", - start=true, - mksafe(buffer(news2)))]) diff --git a/receivers.liq b/receivers.liq deleted file mode 100644 index c3717ef..0000000 --- a/receivers.liq +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/local/bin/liquidsoap -v - -# Bolted on by Matthew Stratford 2018 - -%include "conf/ice.conf" -#%include "conf/jukebox.conf" -#%include "conf/am.conf" - -set("init.daemon.pidfile.path", "/usr/local/var/run/liquidsoap/recievers.pid") -set("log.stdout",true) -set("log.level",3) -set("log.file", true) -set("log.file.path","/usr/local/var/log/liquidsoap/receivers.log") - -set("frame.audio.channels",2) -set("frame.audio.samplerate",48000) - -# Sources -am = input.jack(id="am") -am = amplify(1.0, am) -fm = input.jack(id="fm") -fm = amplify (2.5, fm) - -clock.assign_new(id="amStream", -[output.icecast( - %mp3(bitrate=192, samplerate=48000, stereo=true), - host=icehost, - port=iceport, - password=icepass, - mount="am", - url=website, - description=description, - name="AM Reciever Feed | " ^ name, - genre="Student Radio", - start=true, - mksafe(buffer(am)))], -) - -clock.assign_new(id="fmStream", -[output.icecast( - %mp3(bitrate=192, samplerate=48000, stereo=true), - host=icehost, - port=iceport, - password=icepass, - mount="fm", - url=website, - description=description, - name="FM Reciever Feed | " ^ name, - genre="Student Radio", - start=true, - mksafe(buffer(fm)))], -) diff --git a/roses-2021.liq.bak b/roses-2021.liq.bak deleted file mode 100755 index d83ce5f..0000000 --- a/roses-2021.liq.bak +++ /dev/null @@ -1,115 +0,0 @@ -#!/usr/local/bin/liquidsoap -v - -%include "/usr/local/etc/liquidsoap/conf/ice.conf" -# Selecting a main roses stream - -set('server.telnet', true) -set('server.telnet.port', 1369) -set("server.telnet.bind_addr", "144.32.64.170") - -S1 = ref true -S2 = ref false -S3 = ref false -S4 = ref false - -def onS1 () = - !S1 -end -def onS2 () = - !S2 -end -def onS3 () = - !S3 -end -def onS4 () = - !S4 -end - -def selS1 (_) = - S1 := true - S2 := false - S3 := false - S4 := false - "Stream 1 Selected" -end -def selS2 (_) = - S1 := false - S2 := true - S3 := false - S4 := false - "Stream 2 Selected" -end -def selS3 (_) = - S1 := false - S2 := false - S3 := true - S4 := false - "Stream 3 Selected" -end -def selS4 (_) = - S1 := false - S2 := false - S3 := false - S4 := true - "Stream 4 Selected" -end - -server.register("stream1", selS1) -server.register("stream2", selS2) -server.register("stream3", selS3) -server.register("stream4", selS4) - -# A simple cross-fade for transitions -def crossswitch(a,b) - add( - normalize=false, - [ - sequence([ - fade.initial(duration=.2,b) - ]), - fade.final(duration=.2,a) - ] - ) -end - -stream1 = mksafe(audio_to_stereo(input.http("http://audio.ury.org.uk/Roses1",buffer=5.,max=120.))) -stream2 = mksafe(audio_to_stereo(input.http("http://audio.ury.org.uk/Roses2",buffer=5.,max=120.))) -stream3 = mksafe(audio_to_stereo(input.http("http://audio.ury.org.uk/Roses3",buffer=5.,max=120.))) -stream4 = mksafe(audio_to_stereo(input.http("http://audio.ury.org.uk/Roses4",buffer=5.,max=120.))) - -selector = switch( - track_sensitive=false, - transitions=[ - crossswitch, - crossswitch, - crossswitch, - crossswitch - ], - [ - (onS1, stream1), - (onS2, stream2), - (onS3, stream3), - (onS4, stream4) - ] -) - -selector = amplify(0.85, selector) -selector = mksafe(selector) - -output.dummy(fallible=true, stream1) -output.dummy(fallible=true, stream2) -output.dummy(fallible=true, stream3) -output.dummy(fallible=true, stream4) - -output.icecast( - %mp3(bitrate=192), - host=icehost, - port=iceport, - password=icepass, - mount="OB-Line", - start=true, - url=website, - description=description, - name="Roses Main Stream", - genre="Student Radio", - selector) diff --git a/scripts/critical_blank.php b/scripts/blank_handlers/critical_blank.php old mode 100755 new mode 100644 similarity index 100% rename from scripts/critical_blank.php rename to scripts/blank_handlers/critical_blank.php diff --git a/scripts/handle_blank.php b/scripts/blank_handlers/handle_blank.php old mode 100755 new mode 100644 similarity index 100% rename from scripts/handle_blank.php rename to scripts/blank_handlers/handle_blank.php diff --git a/scripts/handle_blank_end.php b/scripts/blank_handlers/handle_blank_end.php old mode 100755 new mode 100644 similarity index 100% rename from scripts/handle_blank_end.php rename to scripts/blank_handlers/handle_blank_end.php diff --git a/scripts/dishy_boi.sh b/scripts/dishy_boi.sh deleted file mode 100755 index d636e65..0000000 --- a/scripts/dishy_boi.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash - -#curl -X POST --data-urlencode 'payload={"text":"The dishy boi appears to have done a fucky wucky. Someone should probably fix that. Thank."}' https://hooks.slack.com/services/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 diff --git a/scripts/fm_new_jacks.sh b/scripts/fm_new_jacks.sh deleted file mode 100755 index e851941..0000000 --- a/scripts/fm_new_jacks.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -jack_connect system:capture_3 fm-stl-pgm:input_1 # Compressor -> FM -jack_connect system:capture_4 fm-stl-pgm:input_2 - -jack_connect jukebox:out_0 fm-stl-jbox:input_1 -jack_connect jukebox:out_1 fm-stl-jbox:input_2 - -jack_connect wspostanews:out_0 fm-stl-anews:input_1 -jack_connect wspostanews:out_1 fm-stl-anews:input_2 diff --git a/scripts/fm_streamer.sh b/scripts/fm_streamer.sh new file mode 100644 index 0000000..371520a --- /dev/null +++ b/scripts/fm_streamer.sh @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +set -euo pipefail + +/home/michaelg/bin/ffmpeg \ + -re `# read input at native rate` \ + -hide_banner `# hide copyright notices etc.` \ + -loglevel warning `# sets log level to warnings or above` \ + -f jack -i fm-stl-pgm -channels 2 `# jack input from jack fm-stl with 2 audio channels` \ + -f jack -i fm-stl-jbox -channels 2 \ + -f jack -i fm-stl-anews -channels 2 \ + -c:a pcm_s16be `# audio codec` \ + -filter_complex "[0]volume@s0=1[a];[1]volume@s1=0[b];[2]volume@s2=0[c];[a][b][c]amix=inputs=3,azmq" \ + -f rtp `# output format (rtp stream)` \ + -sdp_file /tmp/mem.sdp `# session description protocol logging file` \ + rtp://144.32.224.6:18830 `# fmstl pi` & + +sleep 2 + +jack_connect system:capture_3 fm-stl-pgm:input_1 # Compressor -> FM +jack_connect system:capture_4 fm-stl-pgm:input_2 + +jack_connect jukebox:out_0 fm-stl-jbox:input_1 +jack_connect jukebox:out_1 fm-stl-jbox:input_2 + +jack_connect wspostanews:out_0 fm-stl-anews:input_1 +jack_connect wspostanews:out_1 fm-stl-anews:input_2 + +wait diff --git a/scripts/httpStreams.sh b/scripts/httpStreams.sh new file mode 100644 index 0000000..37fd3cf --- /dev/null +++ b/scripts/httpStreams.sh @@ -0,0 +1,21 @@ +#!/usr/bin/env bash + +set -euo pipefail + +OUTPUT="icecast://source:$(grep 'icepass' /usr/local/etc/liquidsoap/conf/ice.conf | cut -d "'" -f 2)@dolby.ury.york.ac.uk:7070" +ICE_FLAGS="-ice_genre 'Student Radio' -ice_description 'The UK\'s oldest legal independent radio station.' -ice_url 'https://ury.org.uk'" + +/home/michaelg/bin/ffmpeg -hide_banner \ + -f jack -i "liveOutput" -channels 2 \ + -filter_complex "TODO" \ + -f mp3 -b:a 192k $ICE_FLAGS -ice_name "University Radio York - High Quality" $OUTPUT/live-high \ + -f mp3 -b:a 48k $ICE_FLAGS -ice_name "University Radio York - Mobile" $OUTPUT/live-mobile \ + -f ogg -b:a 128k $ICE_FLAGS -ice_name "University Radio York - OGG Stream" -content_type audio/ogg $OUTPUT/live-high-ogg \ + -f ogg -c:a flac $ICE_FLAGS -ice_name "University Radio York - FLAC Stream" -content_type audio/ogg $OUTPUT/live-high-flac & + +sleep 2 + +jack_connect system:capture_3 liveOutput:input_1 #TX Compressor to Online Streams L +jack_connect system:capture_4 liveOutput:input_2 #TX Compressor to Online Streams R + +wait diff --git a/scripts/jackConnect.sh b/scripts/jackConnect.sh index fa0f843..8be0238 100755 --- a/scripts/jackConnect.sh +++ b/scripts/jackConnect.sh @@ -1,105 +1,47 @@ -#!/bin/sh -#the capture inputs go scarlett Analogue 1-8 in, SPDIF 1-2 in, ADAT 1-8 mstratford-2019 -# playbacks go Analogue 1-10 out, spdif 1-2 out, ADAT 1-8 out. +#!/usr/bin/env bash + +set -euo pipefail + +# The capture inputs go Scarlett Analogue 1-8 in, SPDIF 1-2 in, ADAT 1-8 mstratford-2019 +# Playbacks go Analogue 1-10 out, spdif 1-2 out, ADAT 1-8 out. # Scarlett headphone ports are playback 7/8 and 9/10. + +# Selector Sources jack_connect system:capture_11 selStudio1:in_0 jack_connect system:capture_12 selStudio1:in_1 + jack_connect system:capture_13 selStudio2:in_0 jack_connect system:capture_14 selStudio2:in_1 -jack_connect system:capture_11 directStudio1:in_0 -jack_connect system:capture_12 directStudio1:in_1 -jack_connect system:capture_13 directStudio2:in_0 -jack_connect system:capture_14 directStudio2:in_1 -jack_connect jukebox:out_0 system:playback_15 -jack_connect jukebox:out_1 system:playback_16 -jack_connect jukebox:out_0 selJukebox:in_0 -jack_connect jukebox:out_1 selJukebox:in_1 -jack_connect jukebox:out_0 liveJukebox:in_0 -jack_connect jukebox:out_1 liveJukebox:in_1 -jack_connect sine:out_0 selSine:in_0 -jack_connect sine:out_1 selSine:in_1 -jack_connect offair:out_0 selOffAir:in_0 -jack_connect offair:out_1 selOffAir:in_1 -jack_connect obws_out:out_0 system:playback_19 # mraks.polakovs@ury.org.uk, 2020-09-26 -jack_connect obws_out:out_1 system:playback_20 + jack_connect ob:out_0 selOB:in_0 jack_connect ob:out_1 selOB:in_1 -jack_connect ob:out_0 obws_ob:in_0 -jack_connect ob:out_1 obws_ob:in_1 - -jack_connect system:capture_3 liveOutput:in_0 #TX Compressor to Online Streams L -jack_connect system:capture_4 liveOutput:in_1 #TX Compressor to Online Streams R +jack_connect wspostanews:out_0 selWS:in_0 +jack_connect wspostanews:out_1 selWS:in_1 +jack_connect sine:out_0 selSine:in_0 +jack_connect sine:out_1 selSine:in_1 +jack_connect offair:out_0 selOffAir:in_0 +jack_connect offair:out_1 selOffAir:in_1 +# PGM Output jack_connect selector:out_0 system:playback_1 #Selector to TX Compressor L jack_connect selector:out_1 system:playback_2 #Selector to TX Compressor R -jack_connect selector:out_0 system:playback_3 #AM Compressor In (Monoing L) -jack_connect selector:out_1 system:playback_3 #AM Compressor In (Monoing R) -jack_connect selector:out_0 system:playback_4 -jack_connect selector:out_1 system:playback_4 -jack_connect selector:out_0 system:playback_13 # ADAT 1 -> Selector "Online" to studios -jack_connect selector:out_1 system:playback_14 # ADAT 2 // R - - - -jack_connect selector:out_0 system:playback_5 # URYBlue Online Logger L -jack_connect selector:out_1 system:playback_6 # URYBlue Online Logger R -jack_connect system:capture_3 liveOutput:in_0 #TX Compressor to Online Streams L -jack_connect system:capture_4 liveOutput:in_1 #TX Compressor to Online Streams R -jack_connect system:capture_5 am:in_0 -jack_connect system:capture_6 am:in_1 - -jack_connect system:capture_5 system:playback_17 # ADAT 5 // AM Monoed -jack_connect system:capture_6 system:playback_17 -jack_connect system:capture_7 system:playback_18 # ADAT 6 // FM Monoed -jack_connect system:capture_8 system:playback_18 - -jack_connect system:capture_7 fm:in_0 -jack_connect system:capture_8 fm:in_1 - -# Headphone monitor ports on front of scarlett for AM and FM -jack_connect system:capture_5 system:playback_7 -jack_connect system:capture_6 system:playback_8 -jack_connect system:capture_7 system:playback_9 -jack_connect system:capture_8 system:playback_10 - -jack_connect system:capture_17 news:in_0 # IRN 1 (Main hourly news) is left channel -jack_connect system:capture_17 news:in_1 -jack_connect system:capture_18 news2:in_0 # IRN 2 (Important events etc) is right channel -jack_connect system:capture_18 news2:in_1 - -# Leave WebStudio last - because, if services are started in the wrong order, these calls will fail -# - marks.polakovs@ury.org.uk 2020 -# Commented out for new routes below -#jack_connect webstudio:out_0 directWebStudio:in_0 -#jack_connect webstudio:out_1 directWebStudio:in_1 -#jack_connect webstudio:out_0 selWS:in_0 -#jack_connect webstudio:out_1 selWS:in_1 - -# New Routes for WS+AutoNews +# WS+AutoNews jack_connect webstudio:out_0 wspreanews:in_0 jack_connect webstudio:out_1 wspreanews:in_1 -jack_connect wspostanews:out_0 selWS:in_0 -jack_connect wspostanews:out_1 selWS:in_1 + +# OBWS Feeds jack_connect wspostanews:out_0 obws_ws:in_0 jack_connect wspostanews:out_1 obws_ws:in_1 -#jack_connect sine:out_0 directWebStudio:in_0 -#jack_connect sine:out_0 selWS:in_0 -# Change the ones below to 2 once we have a second server. -#jack_connect webstudio:out_0 directWebStudioTwo:in_0 -#jack_connect webstudio:out_1 directWebStudioTwo:in_1 -#jack_connect webstudioOut:out_0 selWS:in_0 -#jack_connect webstudioOut:out_1 selWS:in_1 +jack_connect ob:out_0 obws_ob:in_0 +jack_connect ob:out_1 obws_ob:in_1 -#Isaac is determined to make all of the things cursed -#jack_connect jukebox:out_0 stereo_tool:in_l -#jack_connect jukebox:out_1 stereo_tool:in_r -#jack_connect stereo_tool:out_l stool_out:in_0 +jack_connect obws_out:out_0 system:playback_19 +jack_connect obws_out:out_1 system:playback_20 -# Connect up FM -#./fm_main.sh old -./fm_new_jacks.sh +# Jukebox +./jackConnectJukebox.sh diff --git a/scripts/jackConnectJukebox.sh b/scripts/jackConnectJukebox.sh new file mode 100644 index 0000000..5ebe57c --- /dev/null +++ b/scripts/jackConnectJukebox.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash + +set -euo pipefail + +jack_connect jukebox:out_0 system:playback_15 +jack_connect jukebox:out_1 system:playback_16 + +jack_connect jukebox:out_0 selJukebox:in_0 +jack_connect jukebox:out_1 selJukebox:in_1 + +jack_connect jukebox:out_0 fm-stl-jbox:input_1 +jack_connect jukebox:out_1 fm-stl-jbox:input_2 diff --git a/scripts/jackConnectJukeboxOnly.sh b/scripts/jackConnectJukeboxOnly.sh deleted file mode 100755 index 30ab9d1..0000000 --- a/scripts/jackConnectJukeboxOnly.sh +++ /dev/null @@ -1,104 +0,0 @@ -#!/bin/sh -#the capture inputs go scarlett Analogue 1-8 in, SPDIF 1-2 in, ADAT 1-8 mstratford-2019 -# playbacks go Analogue 1-10 out, spdif 1-2 out, ADAT 1-8 out. -# Scarlett headphone ports are playback 7/8 and 9/10. -#jack_connect system:capture_11 selStudio1:in_0 -#jack_connect system:capture_12 selStudio1:in_1 -#jack_connect system:capture_13 selStudio2:in_0 -#jack_connect system:capture_14 selStudio2:in_1 -#jack_connect system:capture_11 directStudio1:in_0 -#jack_connect system:capture_12 directStudio1:in_1 -#jack_connect system:capture_13 directStudio2:in_0 -#jack_connect system:capture_14 directStudio2:in_1 -jack_connect jukebox:out_0 system:playback_15 -jack_connect jukebox:out_1 system:playback_16 -jack_connect jukebox:out_0 selJukebox:in_0 -jack_connect jukebox:out_1 selJukebox:in_1 -jack_connect jukebox:out_0 liveJukebox:in_0 -jack_connect jukebox:out_1 liveJukebox:in_1 -#jack_connect sine:out_0 selSine:in_0 -#jack_connect sine:out_1 selSine:in_1 -#jack_connect offair:out_0 selOffAir:in_0 -#jack_connect offair:out_1 selOffAir:in_1 -#jack_connect obws_out:out_0 system:playback_19 # mraks.polakovs@ury.org.uk, 2020-09-26 -#jack_connect obws_out:out_1 system:playback_20 -#jack_connect ob:out_0 selOB:in_0 -#jack_connect ob:out_1 selOB:in_1 -#jack_connect ob:out_0 obws_ob:in_0 -#jack_connect ob:out_1 obws_ob:in_1 - - -#jack_connect system:capture_3 liveOutput:in_0 #TX Compressor to Online Streams L -#jack_connect system:capture_4 liveOutput:in_1 #TX Compressor to Online Streams R - - - -#jack_connect selector:out_0 system:playback_1 #Selector to TX Compressor L -#jack_connect selector:out_1 system:playback_2 #Selector to TX Compressor R -#jack_connect selector:out_0 system:playback_3 #AM Compressor In (Monoing L) -#jack_connect selector:out_1 system:playback_3 #AM Compressor In (Monoing R) -#jack_connect selector:out_0 system:playback_4 -#jack_connect selector:out_1 system:playback_4 -#jack_connect selector:out_0 system:playback_13 # ADAT 1 -> Selector "Online" to studios -#jack_connect selector:out_1 system:playback_14 # ADAT 2 // R - - - -#jack_connect selector:out_0 system:playback_5 # URYBlue Online Logger L -#jack_connect selector:out_1 system:playback_6 # URYBlue Online Logger R -#jack_connect system:capture_3 liveOutput:in_0 #TX Compressor to Online Streams L -#jack_connect system:capture_4 liveOutput:in_1 #TX Compressor to Online Streams R -#jack_connect system:capture_5 am:in_0 -#jack_connect system:capture_6 am:in_1 - -#jack_connect system:capture_5 system:playback_17 # ADAT 5 // AM Monoed -#jack_connect system:capture_6 system:playback_17 -#jack_connect system:capture_7 system:playback_18 # ADAT 6 // FM Monoed -#jack_connect system:capture_8 system:playback_18 - -#jack_connect system:capture_7 fm:in_0 -#jack_connect system:capture_8 fm:in_1 - -# Headphone monitor ports on front of scarlett for AM and FM -#jack_connect system:capture_5 system:playback_7 -#jack_connect system:capture_6 system:playback_8 -#jack_connect system:capture_7 system:playback_9 -#jack_connect system:capture_8 system:playback_10 - -#jack_connect system:capture_17 news:in_0 # IRN 1 (Main hourly news) is left channel -#jack_connect system:capture_17 news:in_1 -#jack_connect system:capture_18 news2:in_0 # IRN 2 (Important events etc) is right channel -#jack_connect system:capture_18 news2:in_1 - - -# Leave WebStudio last - because, if services are started in the wrong order, these calls will fail -# - marks.polakovs@ury.org.uk 2020 -# Commented out for new routes below -#jack_connect webstudio:out_0 directWebStudio:in_0 -#jack_connect webstudio:out_1 directWebStudio:in_1 -#jack_connect webstudio:out_0 selWS:in_0 -#jack_connect webstudio:out_1 selWS:in_1 - -# New Routes for WS+AutoNews -#jack_connect webstudio:out_0 wspreanews:in_0 -#jack_connect webstudio:out_1 wspreanews:in_1 -#jack_connect wspostanews:out_0 selWS:in_0 -#jack_connect wspostanews:out_1 selWS:in_1 -#jack_connect wspostanews:out_0 obws_ws:in_0 -#jack_connect wspostanews:out_1 obws_ws:in_1 - -#jack_connect sine:out_0 directWebStudio:in_0 -#jack_connect sine:out_0 selWS:in_0 -# Change the ones below to 2 once we have a second server. -#jack_connect webstudio:out_0 directWebStudioTwo:in_0 -#jack_connect webstudio:out_1 directWebStudioTwo:in_1 -#jack_connect webstudioOut:out_0 selWS:in_0 -#jack_connect webstudioOut:out_1 selWS:in_1 - -#Isaac is determined to make all of the things cursed -#jack_connect jukebox:out_0 stereo_tool:in_l -#jack_connect jukebox:out_1 stereo_tool:in_r -#jack_connect stereo_tool:out_l stool_out:in_0 - -# Connect up FM -#./fm_main.sh diff --git a/mattsat/mattsat.sh b/scripts/mattsat.sh old mode 100755 new mode 100644 similarity index 100% rename from mattsat/mattsat.sh rename to scripts/mattsat.sh diff --git a/scripts/physicalToIcecast.sh b/scripts/physicalToIcecast.sh new file mode 100644 index 0000000..bbd0d34 --- /dev/null +++ b/scripts/physicalToIcecast.sh @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +set -euo pipefail + +publish () { + local jack=$1; + local mount=$2; + local strm_name=$3; + + /home/michaelg/bin/ffmpeg -re -hide_banner \ + -f jack -i "${jack}" -channels 2 \ + -filter_complex "[0:a]ebur128=target=-16:video=1[vid][aud]" \ + -ice_genre "Student Radio" -ice_name "URY - ${strm_name}" -ice_description "Direct feed from ${strm_name}" -ice_url "https://ury.org.uk" \ + -f mp3 -map "[aud]" icecast://source:$(grep 'icepass' /usr/local/etc/liquidsoap/conf/ice.conf | cut -d "'" -f 2)@dolby.ury.york.ac.uk:7070/${mount} \ + -f null -map "[vid]" /dev/null +} + +publish "fm" "fm" "FM" & +publish "news" "news" "IRN News 1" & +publish "news2" "news2" "IRN News 2" & +publish "directStudio1" "studio-red" "Studio Red" & +publish "directStudio2" "studio-blue" "Studio Blue" & + +sleep 2 + +jack_connect system:capture_11 directStudio1:input_1 +jack_connect system:capture_12 directStudio1:input_2 + +jack_connect system:capture_13 directStudio2:input_1 +jack_connect system:capture_14 directStudio2:input_2 + +jack_connect system:capture_7 fm:input_1 +jack_connect system:capture_8 fm:input_2 + +jack_connect system:capture_17 news:input_1 # IRN 1 (Main hourly news) is left channel +jack_connect system:capture_17 news:input_2 + +jack_connect system:capture_18 news2:input_1 # IRN 2 (Important events etc) is right channel +jack_connect system:capture_18 news2:input_2 + +wait diff --git a/scripts/restartJukebox.sh b/scripts/restartJukebox.sh index 5bdd0d4..7efbfdc 100755 --- a/scripts/restartJukebox.sh +++ b/scripts/restartJukebox.sh @@ -1,15 +1,13 @@ -#!/bin/sh +#!/usr/bin/env bash + +set -euo pipefail + sudo pkill -9 -f "jukebox.liq" + sleep 1 -sudo -i -u liquidsoap bash << EOF - liquidsoap -d /usr/local/etc/liquidsoap/jukebox.liq & + +sudo -u liquidsoap liquidsoap -d /usr/local/etc/liquidsoap/jukebox.liq + sleep 5 -jack_connect jukebox:out_0 system:playback_15 -jack_connect jukebox:out_1 system:playback_16 -jack_connect jukebox:out_0 selJukebox:in_0 -jack_connect jukebox:out_1 selJukebox:in_1 -jack_connect jukebox:out_0 liveJukebox:in_0 -jack_connect jukebox:out_1 liveJukebox:in_1 -jack_connect jukebox:out_0 fm-stl-jbox:input_1 -jack_connect jukebox:out_1 fm-stl-jbox:input_2 -EOF + +sudo -u liquidsoap /usr/local/etc/liqiudsoap/scripts/jackConnectJukebox.sh diff --git a/scripts/startAudio.sh b/scripts/startAudio.sh index 67545c3..b317b04 100755 --- a/scripts/startAudio.sh +++ b/scripts/startAudio.sh @@ -15,11 +15,11 @@ echo Restarting WS shittyserver sudo systemctl restart shittyserver sleep 2 -echo Starting FM Streamer # must be done before jack connections -sudo systemctl restart fm-streamer -sleep 5 - echo jackConnecting sudo -u liquidsoap ./jackConnect.sh -#/usr/local/etc/liquidsoap/scripts/jackConnect.sh -#sudo service dearie-me restart +sleep 2 + +sudo service dearie-me restart + +echo Starting FM Streamer +sudo systemctl restart fm-streamer diff --git a/scripts/stateserver.py b/scripts/stateserver.py deleted file mode 100755 index 9399ee4..0000000 --- a/scripts/stateserver.py +++ /dev/null @@ -1,353 +0,0 @@ -#!flask/bin/python -## IMPORTANT ASSUMPTIONS MADE: -# show timestamps start on the hour. -# normal shows in real studios aren't currently a thing!!! -import subprocess -from flask import Flask, jsonify, request -from flask_cors import CORS -import requests -import datetime -import random -from telnetlib import Telnet - -api_key = "y2u%H%hpZID603j41Clkfks23k2dkglfjkfe3k4k2k4lk23qj2" -app = Flask(__name__) -CORS(app) # Enable Cors access-all - - -SUSTAINER_AUTONEWS = True - - -def do_ws_srv_telnet(source): - HOST = "localhost" - print("telnet localhost 8078 SEL {}".format(source)) - tn = Telnet(HOST,8078) - tn.write(b"SEL " + str.encode(source) + b"\n") - try: - print(tn.read_until(b"\n").decode("utf-8")) - except EOFError: - pass - else: - tn.close() - -def genFail(reason, code=400): - return jsonify({"status": "FAIL", "reason": reason}) - -def genPayload(payload): - return jsonify({"status": "OK", "payload": payload}) - -def myradioApiRequest(url): - - res = requests.get('https://ury.org.uk/api/v2/' + url + '?api_key=' + api_key) - if res.ok: - return res.json()["payload"] - - -def getNextHourTimestamp(): - current = datetime.datetime.now() - currentPlusHour = current + datetime.timedelta(hours = 1) - nextHourStart = currentPlusHour.replace(minute=0,second=0) - nextTimestamp = int(nextHourStart.timestamp()) - return nextTimestamp - -def getConnByID(connID): - for conn in connections: - if conn["connid"] == connID: - return conn - return None - -SOURCE_JUKEBOX = 3 # Set to 8 for testing. -SOURCE_OB = 4 -SOURCE_WS = 5 -SOURCE_OFFAIR = 8 -SOURCES = [SOURCE_JUKEBOX, SOURCE_OB, SOURCE_WS, SOURCE_OFFAIR] - - - -# This array will only hold connections we've validated to be authorised to broadcast. -connections = [] -wsSessions = [] -lastConnectionIDToRegister = -1 - -def getCurrentShowConnection(): - for connection in connections: - if (connection["startTimestamp"] <= datetime.datetime.now().timestamp()) and (connection["endTimestamp"] >= getNextHourTimestamp()): - return connection - return None - -def getNextHourConnection(): - nextHourTimestamp = getNextHourTimestamp() - isConnectionEnding = False - for connection in connections: - if connection["startTimestamp"] == nextHourTimestamp: - return connection - if connection["endTimestamp"] == nextHourTimestamp: - isConnectionEnding = True - - if not isConnectionEnding: - # There isn't a show that starts at the next hour, so we're returning the current connection. - return getCurrentShowConnection() - else: - # The show is ending, return no next show. - return None - -def cleanOldConnections(): - global connections - for i in range(len(connections)): - if connections[i]["endTimestamp"] < datetime.datetime.now().timestamp(): - connections.pop(i) - - -def stateDecider(): - currentConnection = getCurrentShowConnection() - nextConnection = getNextHourConnection() - print("currentConnection:", currentConnection) - print("nextConnection:", nextConnection) - willRunAutoNews = True - switchAudioAtMin = 2 - newSelSource = None - newWSSource = None - if currentConnection != nextConnection: - print("Will be transitioning") - # The show is transitioning this hour. - if currentConnection: - print("There's a current connection.") - # Current show wants to end their show at 2 mins past - if currentConnection["autoNewsEnd"] == False: - print("This show doesn't want to end with news.") - willRunAutoNews = False - switchAudioAtMin = 2 # no real change here - if nextConnection: - print("There's a next connection.") - # next show wants to begin at 0 mins past hour. - if nextConnection["autoNewsBeginning"] == False: - print("The next connection doesn't want news at start.") - willRunAutoNews = False - switchAudioAtMin = 0 - - newSelSource = nextConnection["sourceid"] - newWSSource = nextConnection["wsid"] # None if show is not a WS. - else: - print("No next show, going back to jukebox.") - # There isn't a next show, go back to sustainer - newSelSource = SOURCE_JUKEBOX - - else: - # Show/sustainer is continuing for another hour. - print("Show / Sustainer is continuing this hour.") - if currentConnection: - print("We're currently doing a show, so check if they want middle news.") - willRunAutoNews = currentConnection["autoNewsMiddle"] - newSelSource = currentConnection["sourceid"] - newWSSource = currentConnection["wsid"] - elif SUSTAINER_AUTONEWS: - print("There's no show on currently, so we're going to AutoNEWS on sustainer") - # Jukebox -> NEWS -> Jukebox - newSelSource = SOURCE_JUKEBOX - else: - print("There's no show on currently, but AutoNews on sustainer is disabled, so don't do news") - # Jukebox -> Jukebox - newSelSource = SOURCE_JUKEBOX - switchAudioAtMin = 0 - willRunAutoNews = False - - - - nextState = { - "autoNews": willRunAutoNews, - "switchAudioAtMin": switchAudioAtMin, - "selSource": newSelSource, - "wsSource": newWSSource - } - - return nextState - - -@app.route('/api/v1/status', methods=['GET']) -def get_status(): - print(getNextHourTimestamp()) - global connections - cleanOldConnections() - return genPayload( - { - "connections": connections, - "wsSessions": wsSessions - } - ) - -@app.route('/api/v1/nextTransition', methods=['GET']) -def get_next_transition(): - cleanOldConnections() - return genPayload(stateDecider()) - - -@app.route('/api/v1/cancelTimeslot', methods=['POST']) -def post_cancelCheck(): - global connections - content = request.json - if not content: - return genFail("No parameters provided.") - if not isinstance(content["connid"], int): - return genFail("Request missing valid connid.") - - #We're gonna cancel their show. - currentShow = getCurrentShowConnection() - if currentShow and currentShow["connid"] == content["connid"]: - # this show is (at least supposed to be) live now. - # kill their show - do_ws_srv_telnet("NUL") - switch_proc = subprocess.Popen(["sel", str(SOURCE_JUKEBOX)]) - pass - for i in range(len(connections)): - if connections[i]["connid"] == content["connid"]: - connections.pop(i) - return genPayload("Connection cancelled.") - return genFail("Connection not found.") - -@app.route('/api/v1/registerTimeslot', methods=['POST']) -def post_registerCheck(): - global connections - global lastConnectionIDToRegister - - content = request.json - if not content: - return genFail("No parameters provided.") - if not isinstance(content["timeslotid"], int): - return genFail("Request missing valid timeslotid.") - if not isinstance(content["memberid"], int): - return genFail("Request missing valid memberid.") - if not isinstance(content["sourceid"], int): - return genFail("Request missing valid source.") - if not content["sourceid"] in SOURCES: - return genFail("Request missing valid source.") - - - member = myradioApiRequest("user/" + str(content["memberid"])) - if not member: - return genFail("Could not get member.") - - timeslot = myradioApiRequest("timeslot/" + str(content["timeslotid"])) - if not timeslot: - return genFail("Could not get tiemslot.") - - found_credit = False - for credit in timeslot["credits"]: - if content["memberid"] == credit["memberid"]: - found_credit = True - break - if not found_credit: - return genFail("You are not authorised to broadcast for this timeslot.") - - for conn in connections: - if content["timeslotid"] == conn["timeslotid"]: - # they've already registered, return the existing session - return genPayload(conn) - - start_time = datetime.datetime.strptime(timeslot["start_time"], "%d/%m/%Y %H:%M") - - - duration = timeslot["duration"].split(":") - duration_time = datetime.timedelta(hours = int(duration[0]), minutes= int(duration[1])) - - end_time = start_time + duration_time - - now_time = datetime.datetime.now() - if start_time - now_time > datetime.timedelta(hours = 1): - return genFail("This show too far away, please try again within an hour of starting your show.") - - if start_time + duration_time < now_time: - return genFail("This show has already ended.") - - - random.seed(a=timeslot["timeslot_id"], version=2) - connection = { - "connid": random.randint(0, 100000000), # TODO: this is horrible. I'll sort this later. - "timeslotid": timeslot["timeslot_id"], - "startTimestamp": int(start_time.timestamp()), - "endTimestamp": int(end_time.timestamp()), - "sourceid": content["sourceid"], - 'autoNewsBeginning': True, - 'autoNewsMiddle': True, - 'autoNewsEnd': True, - 'wsid': None - } - connections.append(connection) - print(connections) - - lastConnectionIDToRegister = connection["connid"] - - return genPayload(connection) - - -@app.route('/api/v1/changeTimeslot', methods=['POST']) -def post_settingsCheck(): - global connections - content = request.json - if not content: - return genFail("No parameters provided.") - if not isinstance(content["connid"], int): - return genFail("Request missing valid connID.") - if not isinstance(content["beginning"], bool): - return genFail("Request missing valid beginning bool.") - if not isinstance(content["middle"], bool): - return genFail("Request missing valid middle bool.") - if not isinstance(content["end"], bool): - return genFail("Request missing valid end bool.") - if not isinstance(content["sourceid"], int): - return genFail("Request missing valid sourcid.") - - for conn in connections: - if conn["connid"] == content["connid"]: - conn["autoNewsBeginning"] = content["beginning"] - conn["autoNewsMiddle"] = content["middle"] - conn["autoNewsEnd"] = content["end"] - conn["sourceid"] = content["sourceid"] - return genPayload(conn) - return genFail("No connection found.") - - -@app.route('/api/v1/updateWSSessions', methods=['POST']) -def post_wsSessions(): - global connections - global wsSessions - content = request.json - #if not content: - # return genFail("No parameters provided.") - oldSessions = wsSessions - - wsSessions = content - print("New wsSessions:", wsSessions) - wsids_to_remove = [] - wsids_to_add = [] - for session in oldSessions: - if not oldSessions[session]["connection_id"] in wsSessions: - wsids_to_remove.append(oldSessions[session]["connection_id"]) - - print("wsSessions which have disappeared:", wsids_to_remove) - - for session in wsSessions: - if not wsSessions[session]["connection_id"] in oldSessions: - wsids_to_add.append(wsSessions[session]["connection_id"]) - - print("wsSessions which have appeared:", wsids_to_add) - - for conn in connections: - if conn["connid"] == lastConnectionIDToRegister: - if conn["wsid"] == None and len(wsids_to_add) == 1: - conn["wsid"] = wsids_to_add[0] - #time.sleep(5) - do_ws_srv_telnet(conn["wsid"]) - subprocess.Popen(['sel', '5']) - - if conn["wsid"] in wsids_to_remove: - conn["wsid"] = None - # TODO Make this actually do a disconnect sequence if this is the current show. - #time.sleep(5) - subprocess.Popen(['sel', str(SOURCE_JUKEBOX)]) - do_ws_srv_telnet("NUL") - return genPayload("Thx, K, bye.") - - -if __name__ == '__main__': - app.run(debug=True, host="0.0.0.0") - diff --git a/sel.liq.bak b/sel.liq.bak deleted file mode 100644 index 729ea2c..0000000 --- a/sel.liq.bak +++ /dev/null @@ -1,276 +0,0 @@ - -#!/usr/local/bin/liquidsoap -v - -%include "conf/sel.conf" -#%include "conf/ice.conf" -# -# Streams for the Live output -# -set("init.daemon.pidfile.path", "/usr/local/var/run/liquidsoap/sel.pid") -set("log.level",3) -set("log.stdout", true) -set("log.file", true) -set('log.file.path', '/usr/local/var/log/liquidsoap/sel.log') - - -set('server.telnet', true) -set('server.telnet.port', 1360) - -# Set the OSC port to match TouchOSC's default port -set("osc.port", 8000) - -set("frame.audio.channels",2) -set("frame.audio.samplerate",48000) - - -def fade.final(~id="fade.final",~duration=3.,~type="lin",s) = - fn = mkfade(start=1.,stop=0.,type=type,duration=duration,s) - should_play = ref true - - def fn() = - v = fn() - if v == 0. then - should_play := false - end - v - end - - s = amplify(id=id,fn,s) - switch(track_sensitive=false,[({!should_play},s)]) -end - -# Selector sources (sel num) -# Studio1 (1), Studio2 (2), Jukebox (3), OB (4), WebStudio (5), Sine (7), Off-Air (8) -# Default to Off Air when starting Liq. -S1 = ref false -S2 = ref false -JB = ref false -OB = ref false -WS = ref false -SI = ref false -OF = ref true - -# Functions for reading Selector bools -def onS1 () = - !S1 -end -def onS2 () = - !S2 -end -def onOB () = - !OB -end -def onJB () = - !JB -end -def onWS () = - !WS -end -def onSI () = - !SI -end -def onOF () = - !OF -end - -# Function for changing selector bools -# - returns string for telnet use as this is required -def selS1 (_) = - S1 := true - S2 := false - JB := false - OB := false - WS := false - SI := false - OF := false - "Studio 1 Selected" -end -def selS2 (_) = - S1 := false - S2 := true - JB := false - OB := false - WS := false - SI := false - OF := false - "Studio 2 Selected" -end -def selJB (_) = - S1 := false - S2 := false - JB := true - OB := false - WS := false - SI := false - OF := false - "Jukebox Selected" -end -def selOB (_) = - S1 := false - S2 := false - JB := false - OB := true - WS := false - SI := false - OF := false - "OB Stream Selected" -end -def selWS (_) = - S1 := false - S2 := false - JB := false - OB := false - WS := true - SI := false - OF := false - "WebStudio Stream Selected" -end -def selSI (_) = - S1 := false - S2 := false - JB := false - OB := false - WS := false - SI := true - OF := false - "Sine Wave Selected" -end -def selOF (_) = - S1 := false - S2 := false - JB := false - OB := false - WS := false - SI := false - OF := true - "Off Air Selected" -end - -# Enable selector functions on telnet -server.register("selJB", selJB) -server.register("selS1", selS1) -server.register("selS2", selS2) -server.register("selOB", selOB) -server.register("selWS", selWS) -server.register("selSI", selSI) -server.register("selOF", selOF) - -# OSC Function -# - take string and run selection based on that -# - ignore() turns function returning string to unit -def sel(s) = - if s == "S1" then - ignore(selS1()) - elsif s == "S2" then - ignore(selS2()) - elsif s == "JB" then - ignore(selJB()) - elsif s == "OB" then - ignore(selOB()) - elsif s == "WS" then - ignore(selWS()) - elsif s == "SI" then - ignore(selSI()) - elsif s == "OF" then - ignore(selOF()) - end -end - -# Setup OSC hook for /sel/XX -osc.on_string("/sel", sel) - -# A simple cross-fade for transitions -def crossswitch(a,b) - #old = fade.final(duration=2.5,a) #.2 - #new = fade.initial(duration=2.5,b), #.2 - #add(normalize=false, [sequence([old,new]); -# add( -# normalize=false, -# [ -# #sequence([ -# #blank(duration=2.5), -# #fade.in(duration=5.0,b), -# #]), -# -# fade.out(duration=2.5,a), -# fade.in(duration=2.5,b) -# ] -# ) - add(normalize=false, - [ fade.final(duration=4.,a), sequence([ blank(duration=2.), - fade.initial(duration=2.,b) ]) - ] - ) - # fade.final(duration=5.,type="wow",a) ]) -end - - -# Blank detection system -def blankHandler() - system(blankscript) -end - -def blankEndHandler() - system(blankendscript) -end - -def blankCritHandler() - system(criticalblankscript) -end - - -# Sources -studio1 = input.jack(id="selStudio1") -studio2 = input.jack(id="selStudio2") -# Try to make jukebox<-> studio transitions perfect -jukebox = buffer(buffer=0.1,max=0.1,input.jack(id="selJukebox")) -ob = buffer(buffer=0.1,max=0.1,input.jack(id="selOB")) -webstudio = buffer(buffer=0.1,max=0.1,input.jack(id="selWS")) -sine = input.jack(id="selSine") -offair = input.jack(id="selOffAir") - -# Selector Handlers - -selector = switch( - track_sensitive=false, - - transitions=[ - # crossfade, - # crossfade, - # crossfade, - # crossfade, - # crossfade, - # crossfade, - # crossfade - crossswitch, - crossswitch, - crossswitch, - crossswitch, - crossswitch, - crossswitch, - crossswitch - ], - [ - (onS1, studio1), - (onS2, studio2), - (onJB, jukebox), - (onOB, ob), - (onWS, webstudio), - (onSI, sine), - (onOF, offair) - ] -) - -# Auto News 2020 (moved to webstudio.liq) -#autonews = input.jack(id="autonews") - -#selector = add([selector, mksafe(autonews)]) - -selector = amplify(0.85, selector) - -selector = on_blank(threshold=-55., max_blank=2., min_noise=1., on_noise=blankEndHandler, blankHandler, selector) -selector = on_blank(threshold=-55., max_blank=30., blankCritHandler, selector) - -selector = mksafe(selector) - -output.jack(id="selector", start=true, selector) diff --git a/sine.liq b/sine.liq index 80b7798..957dca3 100644 --- a/sine.liq +++ b/sine.liq @@ -15,4 +15,3 @@ input = amplify(.15, input) # Output to soundcards output.jack(id="sine", start=true, input) -output.jack(id="testnews2", start=true, input) diff --git a/stereotool.liq b/stereotool.liq deleted file mode 100644 index d93d6df..0000000 --- a/stereotool.liq +++ /dev/null @@ -1,32 +0,0 @@ -#!/usr/local/bin/liquidsoap -v - -#%include "conf/sel.conf" -%include "conf/ice.conf" -# -# Streams for the Live output -# -set("init.daemon.pidfile.path", "/usr/local/var/run/liquidsoap/stereotool.pid") -set("log.level",3) -set("log.stdout", true) -set("log.file", true) -set('log.file.path', '/usr/local/var/log/liquidsoap/stereotool.log') - -set("frame.audio.channels",2) -set("frame.audio.samplerate",48000) - -# Sources -studio1 = input.jack(id="stool_out") - -output.icecast( - %mp3(bitrate=192), - host=icehost, - port=iceport, - password=icepass, - mount="stereotool", - url=website, - description="TEST STEREOTOOL " ^ description, - name="URY SelOut | " ^ name, - genre="Student Radio", - start=true, - mksafe(buffer(studio1)) - ) diff --git a/studios.liq b/studios.liq deleted file mode 100644 index 5671277..0000000 --- a/studios.liq +++ /dev/null @@ -1,47 +0,0 @@ -#!/usr/local/bin/liquidsoap -v - -#%include "conf/sel.conf" -%include "conf/ice.conf" -# -# Streams for the Live output -# -set("init.daemon.pidfile.path", "/usr/local/var/run/liquidsoap/studios.pid") -set("log.level",3) -set("log.stdout", true) -set("log.file", true) -set('log.file.path', '/usr/local/var/log/liquidsoap/studios.log') - -set("frame.audio.channels",2) -set("frame.audio.samplerate",48000) - -# Sources -studio1 = input.jack(id="directStudio1") -studio2 = input.jack(id="directStudio2") - -output.icecast( - %mp3(bitrate=192), - host=icehost, - port=iceport, - password=icepass, - mount="studio-red", - url=website, - description="Direct feed from Studio Red. " ^ description, - name="URY Studio Red | " ^ name, - genre="Student Radio", - start=true, - mksafe(buffer(studio1)) - ) - -output.icecast( - %mp3(bitrate=192), - host=icehost, - port=iceport, - password=icepass, - mount="studio-blue", - url=website, - description="Direct feed from Studio Blue. " ^ description, - name="URY Studio Blue | " ^ name , - genre="Student Radio", - start=true, - mksafe(buffer(studio2)) - )