Closed bertfrees closed 1 year ago
What do you see and what do you expect instead? I see this, which gives me an input field for the TTS config file:
The problem becomes clear when you submit a job with all the options left unchanged (so the TTS configuration field is empty). The engine will choke.
Perhaps all inputs are specified in the job request XML, also those that are not required and not specified in the UI?
So the problem happens after the job has been submitted?
Does the web service handle blank inputs gracefully or does it just try to process everything?
It might try to process everything, also blank inputs. However that doesn't seem to be the problem here. This is the XML that is sent by the UI:
<jobRequest xmlns="http://www.daisy.org/ns/pipeline/data">
<nicename>DTBook to DAISY 3</nicename>
<priority>medium</priority>
<script href="http://127.0.0.1:49152/ws/scripts/dtbook-to-daisy3"/>
<input name="tts-config">
<item value="null"/>
</input>
<input name="source">
<item value="file:///Users/bert/src/github/daisy/pipeline-samples/dtbook/hauy_valid.xml"/>
</input>
<option name="include-tts-log">false</option>
<option name="publisher">null</option>
<option name="audio">false</option>
<option name="with-text">true</option>
<option name="word-detection">true</option>
</jobRequest>
(Notice the null
.)
So this issue seems very related to https://github.com/daisy/pipeline-ui/issues/47.
Ok I'm finding that job requests with 'null' or blank values cause the engine to choke, e.g. this gets immediately rejected as a bad request:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<jobRequest xmlns="http://www.daisy.org/ns/pipeline/data">
<nicename>DTBook to EPUB 3</nicename>
<priority>medium</priority>
<script href="http://127.0.0.1:49152/ws/scripts/dtbook-to-epub3"/>
<input name="tts-config">
<item value=""/>
</input>
<input name="source">
<item value="file:///Users/marisa/dev/accessible-books-in-browsers/experiments/content-from-bangladesh/AmarBanglaBoiClass5DaisyMultimedia/dtbook.xml"/>
</input>
<option name="language"></option>
<option name="assert-valid">true</option>
<option name="chunk-size">-1</option>
<option name="audio">false</option>
</jobRequest>
The engine accepts this though, where the empty/null values have been pre-filtered out:
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<jobRequest xmlns="http://www.daisy.org/ns/pipeline/data">
<nicename>DTBook to EPUB 3</nicename>
<priority>medium</priority>
<script href="http://127.0.0.1:49152/ws/scripts/dtbook-to-epub3"/>
<input name="source">
<item value="file:///Users/marisa/dev/accessible-books-in-browsers/experiments/content-from-bangladesh/AmarBanglaBoiClass5DaisyMultimedia/dtbook.xml"/>
</input>
<option name="assert-valid">true</option>
<option name="chunk-size">-1</option>
<option name="audio">false</option>
</jobRequest>
Right. This is the expected behavior. Including an input item
means adding a document to the sequence. Including an option
means binding a value to the option. Non-required inputs/options may have 0 or 1 values. A string value may also be "null" and even "" (blank). A file value may also be the file "null".
The API could be made more forgiving when it comes to files: file names can never be empty so these could automatically be filtered out.
An optional input is an input that is defined in XProc as a
<p:input sequence="false">
but with a default inline binding, e.g.:The "DTBook to EPUB 3" script has such an input.
This is how the web service presents the input: