task¶
This module contains the following classes:
Task
, representing a task;TaskConfiguration
, representing a task configuration.
-
class
aeneas.task.
Task
(config_string=None, rconf=None, logger=None)[source]¶ A structure representing a task, that is, an audio file and an ordered set of text fragments to be synchronized.
Parameters: - config_string (string) – the task configuration string
- rconf (
RuntimeConfiguration
) – a runtime configuration - logger (
Logger
) – the logger object
Raises: TypeError: if
config_string
is notNone
and it is not a Unicode string-
audio_file_path_absolute
¶ The absolute path of the audio file.
Return type: string
-
identifier
¶ The identifier of the task.
Return type: string
-
output_sync_map_file
(container_root_path=None)[source]¶ Output the sync map file for this task.
If
container_root_path
is specified, the output sync map file will be created at the path obtained by joining thecontainer_root_path
and the relative path of the sync map inside the container.Otherwise, the sync map file will be created at the path
self.sync_map_file_path_absolute
.Return the the path of the sync map file created, or
None
if an error occurred.Parameters: container_root_path (string) – the path to the root directory for the output container Return type: string
-
sync_map_file_path_absolute
¶ The absolute path of the sync map file.
Return type: string
-
sync_map_leaves
(fragment_type=None)[source]¶ Return the list of non-empty leaves in the sync map associated with the task.
If
fragment_type
has been specified, return only leaves of that fragment type.Parameters: fragment_type (int) – type of fragment to return Return type: list New in version 1.7.0.
-
text_file_path_absolute
¶ The absolute path of the text file.
Return type: string
-
class
aeneas.task.
TaskConfiguration
(config_string=None)[source]¶ A structure representing a configuration for a task, that is, a series of directives for I/O and processing the task.
Allowed keys:
PPN_TASK_CUSTOM_ID
orcustom_id
PPN_TASK_DESCRIPTION
ordescription
PPN_TASK_LANGUAGE
orlanguage
PPN_TASK_ADJUST_BOUNDARY_AFTERCURRENT_VALUE
oraba_aftercurrent_value
PPN_TASK_ADJUST_BOUNDARY_ALGORITHM
oraba_algorithm
PPN_TASK_ADJUST_BOUNDARY_BEFORENEXT_VALUE
oraba_beforenext_value
PPN_TASK_ADJUST_BOUNDARY_NO_ZERO
oraba_no_zero
PPN_TASK_ADJUST_BOUNDARY_OFFSET_VALUE
oraba_offset_value
PPN_TASK_ADJUST_BOUNDARY_PERCENT_VALUE
oraba_percent_value
PPN_TASK_ADJUST_BOUNDARY_RATE_VALUE
oraba_rate_value
PPN_TASK_ADJUST_BOUNDARY_NONSPEECH_MIN
oraba_nonspeech_min
PPN_TASK_ADJUST_BOUNDARY_NONSPEECH_STRING
oraba_nonspeech_string
PPN_TASK_IS_AUDIO_FILE_DETECT_HEAD_MAX
ori_a_head_max
PPN_TASK_IS_AUDIO_FILE_DETECT_HEAD_MIN
ori_a_head_min
PPN_TASK_IS_AUDIO_FILE_DETECT_TAIL_MAX
ori_a_tail_max
PPN_TASK_IS_AUDIO_FILE_DETECT_TAIL_MIN
ori_a_tail_min
PPN_TASK_IS_AUDIO_FILE_HEAD_LENGTH
ori_a_head
PPN_TASK_IS_AUDIO_FILE_PROCESS_LENGTH
ori_a_process
PPN_TASK_IS_AUDIO_FILE_TAIL_LENGTH
ori_a_tail
PPN_TASK_IS_TEXT_FILE_FORMAT
ori_t_format
PPN_TASK_IS_TEXT_FILE_IGNORE_REGEX
ori_t_ignore_regex
PPN_TASK_IS_TEXT_FILE_TRANSLITERATE_MAP
ori_t_transliterate_map
PPN_TASK_IS_TEXT_MPLAIN_WORD_SEPARATOR
ori_t_mplain_word_separator
PPN_TASK_IS_TEXT_MUNPARSED_L1_ID_REGEX
ori_t_munparsed_l1_id_regex
PPN_TASK_IS_TEXT_MUNPARSED_L2_ID_REGEX
ori_t_munparsed_l2_id_regex
PPN_TASK_IS_TEXT_MUNPARSED_L3_ID_REGEX
ori_t_munparsed_l3_id_regex
PPN_TASK_IS_TEXT_UNPARSED_CLASS_REGEX
ori_t_unparsed_class_regex
PPN_TASK_IS_TEXT_UNPARSED_ID_REGEX
ori_t_unparsed_id_regex
PPN_TASK_IS_TEXT_UNPARSED_ID_SORT
ori_t_unparsed_id_sort
PPN_TASK_OS_FILE_EAF_AUDIO_REF
oro_eaf_audio_ref
PPN_TASK_OS_FILE_FORMAT
oro_format
PPN_TASK_OS_FILE_HEAD_TAIL_FORMAT
oro_h_t_format
PPN_TASK_OS_FILE_ID_REGEX
oro_id_regex
PPN_TASK_OS_FILE_LEVELS
oro_levels
PPN_TASK_OS_FILE_NAME
oro_name
PPN_TASK_OS_FILE_SMIL_AUDIO_REF
oro_smil_audio_ref
PPN_TASK_OS_FILE_SMIL_PAGE_REF
oro_smil_page_ref
Parameters: config_string (string) – the job configuration string Raises: TypeError: if config_string
is notNone
and it is not a Unicode stringRaises: KeyError: if trying to access a key not listed above -
aba_parameters
()[source]¶ Return a dictionary representing the
AdjustBoundaryAlgorithm
parameters stored in this task configuration.Available keys:
algorithm
, tuple: (string, list)nonspeech
, tuple: (TimeValue or None, string)nozero
, bool
Return type: dict