Package nzilbb.labbcat.server.api.media
Class Fragments
- java.lang.Object
-
- nzilbb.labbcat.server.api.APIRequestHandler
-
- nzilbb.labbcat.server.api.media.Fragments
-
public class Fragments extends APIRequestHandler
/api/media/fragments : Extracts fragments of media files.The request method can be GET or POST The servlet expects an array of graph ids, start times and end times, or an array of utterance parameters which identify utterances using the MatchId format. or alternatively a threadId parameter which identifies a search that identifies results utterances.
or alternatively ag_id, start, and end parameters that identify samples, with optional prefix parameters for prefixing file names.
Input HTTP parameters:
- mimeType - (optional) content-type of the format to serialize to;
default is
audio/wav
. - id or ag_id - one or more graph IDs.
- start - one or more start times (in seconds).
- end - one or more end times (in seconds).
- threadId - (optional) The search task ID returned by a previous call to /api/search or /api/results/upload.
- utterance - (optional) MatchIds for the selected results to return, if only a subset is required. This can be specifed instead of id/start/end parameters. This parameter is specified multiple times for multiple values.
- sampleRate - (optional) sample rate (Hz) to encode the mono WAV files with.
- name or collection_name - (optional) name of the collection.
- prefix - (optional) prefix fragment names with a numeric serial number.
- startOffsetColumn - (optional) if threadId identifies a CSV results upload task, this can be used to specify the CSV column that identifies the start time of each fragment. If not specified, the utterance start time is used. Must be specified with endOffsetColumn.
- endOffsetColumn - (optional) if threadId identifies a CSV results upload task, this can be used to specify the CSV column that identifies the end time of each fragment. If not specified, the utterance end time is used. Must be specified with startOffsetColumn.
Output: A wav file for each of the sound fragments specified by the input parameters. If there is only one, the file in returned as the response to the request. If there are more than one, the response is a zipfile containing the output files.
- Author:
- Robert Fromont
- mimeType - (optional) content-type of the format to serialize to;
default is
-
-
Field Summary
-
Fields inherited from class nzilbb.labbcat.server.api.APIRequestHandler
SC_BAD_REQUEST, SC_CONFLICT, SC_FORBIDDEN, SC_INTERNAL_SERVER_ERROR, SC_METHOD_NOT_ALLOWED, SC_NOT_FOUND, SC_OK, SC_UNPROCESSABLE_CONTENT, SC_UNSUPPORTED_MEDIA_TYPE
-
-
Constructor Summary
Constructors Constructor Description Fragments()
Constructor
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
get(RequestParameters parameters, OutputStream out, Consumer<String> contentType, Consumer<String> fileName, Consumer<Integer> httpStatus)
The request method for the handler.-
Methods inherited from class nzilbb.labbcat.server.api.APIRequestHandler
GetSystemAttribute, init, writeResponse
-
-
-
-
Method Detail
-
get
public void get(RequestParameters parameters, OutputStream out, Consumer<String> contentType, Consumer<String> fileName, Consumer<Integer> httpStatus)
The request method for the handler.- Parameters:
parameters
- Request parameter map.out
- Response body stream.contentType
- Receives the content type for specification in the response headers.fileName
- Receives the filename for specification in the response headers.httpStatus
- Receives the response status code, in case of error.
-
-