diff --git a/ptulsconv/broadcast_timecode.py b/ptulsconv/broadcast_timecode.py index d771767..4c8af71 100644 --- a/ptulsconv/broadcast_timecode.py +++ b/ptulsconv/broadcast_timecode.py @@ -2,7 +2,7 @@ from fractions import Fraction import re import math from collections import namedtuple -from typing import Optional +from typing import Optional, SupportsFloat class TimecodeFormat(namedtuple("_TimecodeFormat", "frame_duration logical_fps drop_frame")): @@ -13,7 +13,7 @@ class TimecodeFormat(namedtuple("_TimecodeFormat", "frame_duration logical_fps d else: return frame_count * self.frame_duration - def seconds_to_smpte(self, seconds: Fraction) -> str: + def seconds_to_smpte(self, seconds: SupportsFloat) -> str: frame_count = int(seconds / self.frame_duration) return frame_count_to_smpte(frame_count, self.logical_fps, self.drop_frame) diff --git a/ptulsconv/commands.py b/ptulsconv/commands.py index cc80979..3493bc0 100644 --- a/ptulsconv/commands.py +++ b/ptulsconv/commands.py @@ -5,6 +5,7 @@ import sys from itertools import chain import csv from typing import List +from fractions import Fraction from .docparser.adr_entity import make_entities from .reporting import print_section_header_style, print_status_style, print_warning @@ -59,10 +60,12 @@ def output_adr_csv(lines: List[ADRLine], time_format: TimecodeFormat): 'Reason', 'Note', 'TV']) for event in these_lines: + this_start = event.start or 0 + this_finish = event.finish or 0 this_row = [event.title, event.character_name, event.cue_number, event.reel, event.version, - time_format.seconds_to_smpte(event.start), time_format.seconds_to_smpte(event.finish), - float(event.start), float(event.finish), + time_format.seconds_to_smpte(this_start), time_format.seconds_to_smpte(this_finish), + float(this_start), float(this_finish), event.prompt, event.reason, event.note, "TV" if event.tv else ""]