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_stringis notNoneand 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_pathis specified, the output sync map file will be created at the path obtained by joining thecontainer_root_pathand 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
Noneif 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_typehas 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_IDorcustom_idPPN_TASK_DESCRIPTIONordescriptionPPN_TASK_LANGUAGEorlanguagePPN_TASK_ADJUST_BOUNDARY_AFTERCURRENT_VALUEoraba_aftercurrent_valuePPN_TASK_ADJUST_BOUNDARY_ALGORITHMoraba_algorithmPPN_TASK_ADJUST_BOUNDARY_BEFORENEXT_VALUEoraba_beforenext_valuePPN_TASK_ADJUST_BOUNDARY_NO_ZEROoraba_no_zeroPPN_TASK_ADJUST_BOUNDARY_OFFSET_VALUEoraba_offset_valuePPN_TASK_ADJUST_BOUNDARY_PERCENT_VALUEoraba_percent_valuePPN_TASK_ADJUST_BOUNDARY_RATE_VALUEoraba_rate_valuePPN_TASK_ADJUST_BOUNDARY_NONSPEECH_MINoraba_nonspeech_minPPN_TASK_ADJUST_BOUNDARY_NONSPEECH_STRINGoraba_nonspeech_stringPPN_TASK_IS_AUDIO_FILE_DETECT_HEAD_MAXori_a_head_maxPPN_TASK_IS_AUDIO_FILE_DETECT_HEAD_MINori_a_head_minPPN_TASK_IS_AUDIO_FILE_DETECT_TAIL_MAXori_a_tail_maxPPN_TASK_IS_AUDIO_FILE_DETECT_TAIL_MINori_a_tail_minPPN_TASK_IS_AUDIO_FILE_HEAD_LENGTHori_a_headPPN_TASK_IS_AUDIO_FILE_PROCESS_LENGTHori_a_processPPN_TASK_IS_AUDIO_FILE_TAIL_LENGTHori_a_tailPPN_TASK_IS_TEXT_FILE_FORMATori_t_formatPPN_TASK_IS_TEXT_FILE_IGNORE_REGEXori_t_ignore_regexPPN_TASK_IS_TEXT_FILE_TRANSLITERATE_MAPori_t_transliterate_mapPPN_TASK_IS_TEXT_MPLAIN_WORD_SEPARATORori_t_mplain_word_separatorPPN_TASK_IS_TEXT_MUNPARSED_L1_ID_REGEXori_t_munparsed_l1_id_regexPPN_TASK_IS_TEXT_MUNPARSED_L2_ID_REGEXori_t_munparsed_l2_id_regexPPN_TASK_IS_TEXT_MUNPARSED_L3_ID_REGEXori_t_munparsed_l3_id_regexPPN_TASK_IS_TEXT_UNPARSED_CLASS_REGEXori_t_unparsed_class_regexPPN_TASK_IS_TEXT_UNPARSED_ID_REGEXori_t_unparsed_id_regexPPN_TASK_IS_TEXT_UNPARSED_ID_SORTori_t_unparsed_id_sortPPN_TASK_OS_FILE_EAF_AUDIO_REForo_eaf_audio_refPPN_TASK_OS_FILE_FORMAToro_formatPPN_TASK_OS_FILE_HEAD_TAIL_FORMAToro_h_t_formatPPN_TASK_OS_FILE_ID_REGEXoro_id_regexPPN_TASK_OS_FILE_LEVELSoro_levelsPPN_TASK_OS_FILE_NAMEoro_namePPN_TASK_OS_FILE_SMIL_AUDIO_REForo_smil_audio_refPPN_TASK_OS_FILE_SMIL_PAGE_REForo_smil_page_ref
Parameters: config_string (string) – the job configuration string Raises: TypeError: if config_stringis notNoneand it is not a Unicode stringRaises: KeyError: if trying to access a key not listed above -
aba_parameters()[source]¶ Return a dictionary representing the
AdjustBoundaryAlgorithmparameters stored in this task configuration.Available keys:
algorithm, tuple: (string, list)nonspeech, tuple: (TimeValue or None, string)nozero, bool
Return type: dict