Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
engine-core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AURA
engine-core
Commits
dd48d6d3
Verified
Commit
dd48d6d3
authored
7 months ago
by
Ole Binder
Browse files
Options
Downloads
Patches
Plain Diff
Chore: add and improve tests
parent
877a283b
No related branches found
No related tags found
1 merge request
!17
Yaml configuration file
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
tests/test_mixer_queue_tns.liq
+5
-57
5 additions, 57 deletions
tests/test_mixer_queue_tns.liq
tests/test_recorder_on_metadata.liq
+87
-0
87 additions, 0 deletions
tests/test_recorder_on_metadata.liq
with
92 additions
and
57 deletions
tests/test_mixer_queue_tns.liq
+
5
−
57
View file @
dd48d6d3
#!/usr/bin/env liquidsoap
#
# Aura Engine (https://gitlab.servus.at/aura/engine)
#
# Copyright (C) 2017-now() - The Aura Engine Team.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
%include "base_config.liq"
settings.log.level.set(3)
##################################################################################################
# Setup sources
settings.server.telnet.set(true)
settings.server.telnet.bind_addr.set("0.0.0.0")
settings.server.telnet.port.set(1234)
# Create fallback playlist
fallback_folder =
...
...
@@ -30,42 +10,10 @@ fallback_folder = mksafe(fallback_folder)
# Create mixer with one queue
in_queue = request.queue(id="in_queue")
input_queue_0 =
amplify(id="in_queue_amplify", 1., override="replay_gain", in_queue)
mixer = mix(id="mixer", [input_queue_0.{id="in_queue_mixer"}])
input_queue_0 = amplify(id="in_queue", 1., override="replay_gain", in_queue)
mixer = mix(id="mixer", [input_queue_0.{id="in_queue"}])
stripped_mixer = blank.strip(max_blank=5., mixer)
# Output
main_out = fallback(track_sensitive=false, [stripped_mixer, fallback_folder])
output.jack(id="pcm.aura_engine", mksafe(main_out))
##################################################################################################
# Test case (Liquidsoap 2.1, DEB or Docker version)
# 1. Add requests
r1 = request.create("assets/audio.mp3")
r2 = request.create("assets/audio.mp3")
r3 = request.create("assets/audio.mp3")
in_queue.push(r1)
in_queue.push(r2)
in_queue.push(r3)
# 2. Fallback is playing
print(
"Fallback playing"
)
# 3. Wait 5 seconds and activate queue via server commands
def show_mixer() =
print(
"Show mixer.inputs"
)
r = server.execute("mixer.inputs")
print(r)
print(
"Show all functions::"
)
r = server.execute("help")
print(r)
end
thread.run(delay=5., {show_mixer()})
This diff is collapsed.
Click to expand it.
tests/test_recorder_on_metadata.liq
0 → 100644
+
87
−
0
View file @
dd48d6d3
%include "base_config.liq"
# 1.) Metadata handler to be called when track starts
def on_metadata_notification(meta) =
print(
"TITLE: #{meta['title']}"
)
print(
"ON AIR: #{meta['on_air']}"
)
end
# 2.) Invalid source to test fallback
empty_source =
blank.strip(
id="invalid_source",
track_sensitive=false,
max_blank=15.,
min_noise=0.,
threshold=-80.,
blank()
)
# 3.) Fallback
fallback_source =
playlist(
id="fallback_folder",
"/var/audio/fallback",
mode="randomize",
reload=300,
reload_mode="seconds"
)
fallback_source =
source.on_track(
id="fallback_folder", fallback_source, on_metadata_notification
)
fallback_source = mksafe(fallback_source)
current_show_id = ref("-1")
def reopen_on_new_show(meta) =
print(
"reopen recording..."
)
print(meta)
if
current_show_id() == meta["show_id"]
then
print(
"same show, do nothing"
)
false
else
current_show_id := meta["show_id"]
print(
"new show, reopen.."
)
true
end
end
def reopen_on_track(metadata) =
print(
"reopen on track"
)
print(metadata)
end
# 4.) Mix and output
main_source =
fallback(
id="fallback-source",
track_sensitive=false,
replay_metadata=true,
[empty_source, fallback_source]
)
recording =
output.file(
id="recorder_test",
fallible=true,
%mp3,
reopen_on_metadata=reopen_on_new_show,
'/var/audio/recording/show/test_%H%M%S.mp3',
main_source
)
output.jack(id="lineout", main_source)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment