Add audiowidget endpoint: Blueprint renders audiowidget.tmpl, PaneCP fetches it on synthesis completion

This commit is contained in:
c0dev0id
2026-06-24 18:52:26 +02:00
parent 06c077b7f8
commit be338c2de0
5 changed files with 60 additions and 16 deletions

View File

@@ -0,0 +1,18 @@
{# audiowidget.tmpl.stub — copy to audiowidget.tmpl in the same directory to activate.
Customise to match your site's look and feel.
Context variables (passed as query params by the score editor):
result_url URL of the rendered MP3, or empty string
errors synthesis error message, or empty string
#}
{% if errors %}
<div class="se-error">{{ errors }}</div>
{% elif result_url %}
<figure class="audio-result">
<figcaption>Rendered result</figcaption>
<audio controls preload="metadata" style="display:block;width:100%">
<source src="{{ result_url }}" type="audio/mpeg">
<a href="{{ result_url }}">Download MP3</a>
</audio>
</figure>
{% endif %}

View File

@@ -14,8 +14,9 @@ window.NEUSICIAN_URLS = {
astlog: "{{ url_for('astlog') }}",
score: "{{ url_for('score') }}",
status: "{{ url_for('statusjson') }}",
result: "{{ url_for('send_audio_generated') }}",
submit: "{{ url_for('public-yaml-acceptor') }}"
result: "{{ url_for('send_audio_generated') }}",
submit: "{{ url_for('public-yaml-acceptor') }}",
audiowidget: "{{ url_for('vue3_neusik.audiowidget') }}"
};
</script>
<script type="importmap">