Bug fixes

This commit is contained in:
Jamie Hardt
2022-11-04 13:06:38 -07:00
parent da5b743191
commit a7b5adfffb
2 changed files with 7 additions and 4 deletions

View File

@@ -2,7 +2,7 @@ from fractions import Fraction
import re import re
import math import math
from collections import namedtuple from collections import namedtuple
from typing import Optional from typing import Optional, SupportsFloat
class TimecodeFormat(namedtuple("_TimecodeFormat", "frame_duration logical_fps drop_frame")): class TimecodeFormat(namedtuple("_TimecodeFormat", "frame_duration logical_fps drop_frame")):
@@ -13,7 +13,7 @@ class TimecodeFormat(namedtuple("_TimecodeFormat", "frame_duration logical_fps d
else: else:
return frame_count * self.frame_duration 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) frame_count = int(seconds / self.frame_duration)
return frame_count_to_smpte(frame_count, self.logical_fps, self.drop_frame) return frame_count_to_smpte(frame_count, self.logical_fps, self.drop_frame)

View File

@@ -5,6 +5,7 @@ import sys
from itertools import chain from itertools import chain
import csv import csv
from typing import List from typing import List
from fractions import Fraction
from .docparser.adr_entity import make_entities from .docparser.adr_entity import make_entities
from .reporting import print_section_header_style, print_status_style, print_warning 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']) 'Reason', 'Note', 'TV'])
for event in these_lines: 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, this_row = [event.title, event.character_name, event.cue_number,
event.reel, event.version, event.reel, event.version,
time_format.seconds_to_smpte(event.start), time_format.seconds_to_smpte(event.finish), time_format.seconds_to_smpte(this_start), time_format.seconds_to_smpte(this_finish),
float(event.start), float(event.finish), float(this_start), float(this_finish),
event.prompt, event.prompt,
event.reason, event.note, "TV" if event.tv else ""] event.reason, event.note, "TV" if event.tv else ""]