This commit is contained in:
Adrian Amaglio 2023-10-02 23:45:09 +02:00
parent 8e04aa4f13
commit a0e674c3e5
5 changed files with 88 additions and 54 deletions

View File

@ -94,6 +94,7 @@
} }
#TODO add this to /etc/docker/daemon.json #TODO add this to /etc/docker/daemon.json
# TODO no it breaks containers acces to internet
#{ #{
# "iptables": false # "iptables": false
#} #}

View File

@ -1,7 +1,7 @@
version: '3' version: '3'
services: services:
anthracite_jukebox: anthracite_jukebox:
image: jeancloud/jukebox:$OMA_DOCKER_VERSION image: registry.gitlab.com/omaradio/core/oma-jukebox:$OMA_DOCKER_VERSION
env_file: .env env_file: .env
environment: environment:
OMA_CONFIG_TelecommandeHost: $RADIO_HOST OMA_CONFIG_TelecommandeHost: $RADIO_HOST
@ -22,7 +22,7 @@ services:
memory: 100M memory: 100M
azurite_jukebox_simulator: azurite_jukebox_simulator:
image: jeancloud/jukebox-simulator:$OMA_DOCKER_VERSION image: registry.gitlab.com/omaradio/core/oma-jukebox-simulator:$OMA_DOCKER_VERSION
env_file: .env env_file: .env
environment: environment:
OMA_CONFIG_TelecommandeHost: $RADIO_HOST OMA_CONFIG_TelecommandeHost: $RADIO_HOST
@ -45,7 +45,7 @@ services:
agate_importer: agate_importer:
image: jeancloud/baseimport:$OMA_DOCKER_VERSION image: registry.gitlab.com/omaradio/core/oma-baseimport:$OMA_DOCKER_VERSION
env_file: .env env_file: .env
environment: environment:
OMA_CONFIG_TelecommandeHost: $RADIO_HOST OMA_CONFIG_TelecommandeHost: $RADIO_HOST
@ -63,7 +63,7 @@ services:
rubis_base_mg: rubis_base_mg:
image: jeancloud/base-mg:$OMA_DOCKER_VERSION image: registry.gitlab.com/omaradio/core/oma-base-mg:$OMA_DOCKER_VERSION
env_file: .env env_file: .env
environment: environment:
OMA_CONFIG_TelecommandeHost: $RADIO_HOST OMA_CONFIG_TelecommandeHost: $RADIO_HOST

View File

@ -1,7 +1,7 @@
version: '3' version: '3'
services: services:
ambre_mux: ambre_mux:
image: jeancloud/mux:$OMA_DOCKER_VERSION image: registry.gitlab.com/omaradio/core/moa-mux:$OMA_DOCKER_VERSION
env_file: .env env_file: .env
environment: environment:
OMA_CONFIG_Client1Host: $NET.108 OMA_CONFIG_Client1Host: $NET.108
@ -22,7 +22,7 @@ services:
saphir_telecom_server: saphir_telecom_server:
image: jeancloud/telecom-server:$OMA_DOCKER_VERSION image: registry.gitlab.com/omaradio/core/oma-telecom-server:$OMA_DOCKER_VERSION
env_file: .env env_file: .env
ports: ports:
- $TELECOM_SERVER_PORT:3490 - $TELECOM_SERVER_PORT:3490
@ -37,7 +37,7 @@ services:
memory: 100M memory: 100M
amarante_webserver: amarante_webserver:
image: jeancloud/webserver:$OMA_DOCKER_VERSION image: registry.gitlab.com/omaradio/core/oma-webserver:$OMA_DOCKER_VERSION
env_file: .env env_file: .env
environment: environment:
OMA_CONFIG_TelecommandeHost: $NET$TELECOM OMA_CONFIG_TelecommandeHost: $NET$TELECOM
@ -58,7 +58,7 @@ services:
image: savonet/liquidsoap:v2.1.4 image: savonet/liquidsoap:v2.1.4
env_file: .env env_file: .env
volumes: volumes:
- ./icecast.liq:/transcode.liq - ./liquidsoap.liq:/transcode.liq
- $SOUNDBASE_DIR:/soundbase - $SOUNDBASE_DIR:/soundbase
command: /transcode.liq command: /transcode.liq
restart: unless-stopped restart: unless-stopped

View File

@ -1,46 +0,0 @@
#!/usr/bin/liquidsoap
def clean_and_check (filename)
ts = string.split(separator='/', filename)
ts = int_of_string(list.hd(string.split(separator='\.', list.nth(ts, list.length(ts)-1))))
integrity_check (ts)
clean_old_pige (ts)
end
def clean_and_check (filename)
end
def integrity_check(filename)
if ts mod 60 != 0 then
log.important("#{filename} is to fix")
end
end
# Mux
input1 = mksafe(input.harbor("direct.ogg",port=8000,password="JsCabjWJUZXrrrKCaaRZma5wD4YKj5LQLXv6f"))
# Direct mp3
output.icecast(
%mp3(bitrate=128, samplerate=22050, stereo=false),
mount="/direct.mp3",
host="icecast", port=8000, password="JsCabjWJUZXrrrKCaaRZma5wD4YKj5LQLXv6f",
input1)
# Radioking
#output.icecast(
# %mp3(bitrate=128, samplerate=22050, stereo=false),
# mount="/test355",
# host="live.radioking.com", port=80, user="", password="",
# input)
# Direct ogg
output.icecast(
%vorbis(samplerate=44100, channels=1, quality=0.2),
mount="/direct.ogg",
host="icecast", port=8000, password="JsCabjWJUZXrrrKCaaRZma5wD4YKj5LQLXv6f",
input1)
# Pige
output.file(%vorbis(samplerate=44100, channels=1, quality=0.2), {"/soundbase/pige/#{int_of_float(time())}.ogg"}, input1, reopen_when={0s}, reopen_delay=1.0, on_close=clean_and_check)

View File

@ -0,0 +1,79 @@
#!/usr/bin/liquidsoap
# Extract timestamp from pige path
def ts_from_filepath (filepath)
splitpath = string.split(separator='/', filepath)
# Keep only filename
filename = list.nth(splitpath,list.length(splitpath)-1)
int_of_string(list.hd(string.split(separator='\\.', filename)))
end
# Remove pige from now-1month
def clean_single_old_pige(ts)
# ts of one month sooner
ts = ts - 2678400
filepath = "/soundbase/pige/#{ts}.ogg"
if file.exists("#{filepath}") then
process.run("rm #{filepath}")
end
end
# Remove a pige file if it is too old
def clean_if_old(filename)
filepath = "/soundbase/pige/#{filename}"
if ( ts_from_filepath (filename) < int_of_float(time()) - 2678400 ) then
process.run("rm #{filepath}")
end
end
# Check that the timestamp starts exactly on a minute
def integrity_check(ts)
if ts mod 60 != 0 then
log.important("#{ts} is to fix")
end
end
# Routine integrity check for each files
def clean_and_check (filepath)
ts = ts_from_filepath (filepath)
integrity_check (ts)
clean_single_old_pige (ts)
end
# Exaustive integrity check
def clean_and_check_all ()
list.iter(clean_if_old, file.ls("/soundbase/pige/"))
list.iter(clean_and_check, file.ls("/soundbase/pige/"))
end
# Mux
input1 = mksafe(input.harbor("direct.ogg",port=8000,password="JsCabjWJUZXrrrKCaaRZma5wD4YKj5LQLXv6f"))
# Direct mp3
output.icecast(
%mp3(bitrate=128, samplerate=22050, stereo=false),
mount="/direct.mp3",
host="icecast", port=8000, password="JsCabjWJUZXrrrKCaaRZma5wD4YKj5LQLXv6f",
input1)
# Radioking
#output.icecast(
# %mp3(bitrate=128, samplerate=22050, stereo=false),
# mount="/test355",
# host="live.radioking.com", port=80, user="", password="",
# input)
# Direct ogg
output.icecast(
%vorbis(samplerate=44100, channels=1, quality=0.2),
mount="/direct.ogg",
host="icecast", port=8000, password="JsCabjWJUZXrrrKCaaRZma5wD4YKj5LQLXv6f",
input1)
# Pige
output.file(%vorbis(samplerate=44100, channels=1, quality=0.2), {"/soundbase/pige/#{int_of_float(time())}.ogg"}, input1, reopen_when={0s}, reopen_delay=1.0, on_close=clean_and_check)
# Integrity checks
clean_and_check_all()