4. Auxiliary and Helper Modules

4.1. Commands Module

This module provides the main input document parsing and transform implementation.

class ptulsconv.commands.FractionEncoder(*, skipkeys=False, ensure_ascii=True, check_circular=True, allow_nan=True, sort_keys=False, indent=None, separators=None, default=None)[source]

A subclass of JSONEncoder which encodes Fraction objects as a dict.

default(o)[source]
ptulsconv.commands.convert(major_mode, input_file=None, output=<_io.TextIOWrapper name='<stdout>' mode='w' encoding='utf-8'>, warnings=True)[source]

Primary worker function, accepts the input file and decides what to do with it based on the major_mode.

Parameters:
  • input_file – a path to the input file.

  • major_mode – the selected output mode, ‘raw’, ‘tagged’ or ‘doc’.

ptulsconv.commands.create_adr_reports(lines: List[ADRLine], tc_display_format: TimecodeFormat, reel_list: List[str])[source]

Creates a directory heirarchy and a respective set of ADR reports, given a list of lines.

ptulsconv.commands.generate_documents(session_tc_format, scenes, adr_lines: List[ADRLine], title)[source]

Create PDF output.

ptulsconv.commands.output_adr_csv(lines: List[ADRLine], time_format: TimecodeFormat)[source]

Writes ADR lines as CSV to the current working directory. Creates directories for each character number and name pair, and within that directory, creates a CSV file for each reel.

ptulsconv.commands.perform_adr_validations(lines: Iterator[ADRLine])[source]

Performs validations on the input.

4.2. Broadcast Timecode Module

Useful functions for parsing and working with timecode.

class ptulsconv.broadcast_timecode.TimecodeFormat(frame_duration, logical_fps, drop_frame)[source]

A struct reperesenting a timecode datum.

ptulsconv.broadcast_timecode.smpte_to_frame_count(smpte_rep_string: str, frames_per_logical_second: int, drop_frame_hint=False) Optional[int][source]

Convert a string with a SMPTE timecode representation into a frame count.

Parameters:
  • smpte_rep_string – The timecode string

  • frames_per_logical_second – Num of frames in a logical second. This is asserted to be in one of [24,25,30,48,50,60]

  • drop_frame_hintTrue if the timecode rep is drop frame. This is ignored (and implied True) if the last separator in the timecode string is a semicolon. This is ignored (and implied False) if frames_per_logical_second is not 30 or 60.

4.3. Footage Module

Methods for converting string reprentations of film footage.

ptulsconv.footage.footage_to_seconds(footage: str) Optional[Fraction][source]

Converts a string representation of a footage (35mm, 24fps) into a Fraction, this fraction being a some number of seconds.

Parameters:

footage – A string reprenentation of a footage of the form resembling “90+01”.

4.4. Reporting Module

Reporting logic. These methods provide reporting methods to the package and take some pains to provide nice-looking escape codes if we’re writing to a tty.

ptulsconv.reporting.print_advisory_tagging_error(failed_string, position, parent_track_name=None, clip_time=None)[source]
ptulsconv.reporting.print_banner_style(message)[source]
ptulsconv.reporting.print_fatal_error(message)[source]
ptulsconv.reporting.print_section_header_style(message)[source]
ptulsconv.reporting.print_status_style(message)[source]
ptulsconv.reporting.print_warning(warning_string)[source]

4.5. Validations Module

Validation logic for enforcing various consistency rules.

class ptulsconv.validations.ValidationError(message: str, event: Optional[ptulsconv.docparser.adr_entity.ADRLine] = None)[source]
event: Optional[ADRLine] = None
message: str
report_message()[source]
ptulsconv.validations.validate_dependent_value(input_lines: Iterator[ADRLine], key_field, dependent_field)[source]

Validates that two events with the same value in key_field always have the same value in dependent_field

ptulsconv.validations.validate_non_empty_field(input_lines: Iterator[ADRLine], field='cue_number')[source]
ptulsconv.validations.validate_unique_count(input_lines: Iterator[ADRLine], field='title', count=1)[source]
ptulsconv.validations.validate_unique_field(input_lines: Iterator[ADRLine], field='cue_number', scope=None)[source]
ptulsconv.validations.validate_value(input_lines: Iterator[ADRLine], key_field, predicate)[source]