Refactoring

This commit is contained in:
Jamie Hardt
2022-11-19 19:04:53 -08:00
parent 9f24d45f25
commit 2b91f128b9
4 changed files with 12 additions and 13 deletions

View File

@@ -7,14 +7,6 @@ from ptulsconv.commands import convert
from ptulsconv.reporting import print_status_style, print_banner_style, print_section_header_style, print_fatal_error
# TODO: Support Top-level modes
# Modes we want:
# - "raw" : Output the parsed text export document with no further processing, as json
# - "tagged"? : Output the parsed result of the TagCompiler
# - "doc" : Generate a full panoply of PDF reports contextually based on tagging
def dump_field_map(output=sys.stdout):
from ptulsconv.docparser.tag_mapping import TagMapping
from ptulsconv.docparser.adr_entity import ADRLine, GenericEvent

View File

@@ -105,8 +105,8 @@ def generate_documents(session_tc_format, scenes, adr_lines: Iterator[ADRLine],
output_continuity(scenes=scenes, tc_display_format=session_tc_format,
title=title, client=client, supervisor=supervisor)
# reels = sorted([r for r in compiler.compile_all_time_spans() if r[0] == 'Reel'],
# key=lambda x: x[2])
# reels = sorted([r for r in compiler.compile_all_time_spans() if r[0] == 'Reel'],
# key=lambda x: x[2])
reels = ['R1', 'R2', 'R3', 'R4', 'R5', 'R6']
if len(adr_lines) == 0:
@@ -197,7 +197,7 @@ def convert(input_file, major_mode, output=sys.stdout, warnings=True):
if warnings:
perform_adr_validations(adr_lines)
generate_documents(session_tc_format, scenes, adr_lines, title, client)
generate_documents(session_tc_format, scenes, adr_lines, title)
def perform_adr_validations(lines : Iterator[ADRLine]):

View File

@@ -19,6 +19,10 @@ class Event:
class TagCompiler:
"""
Uses a `SessionDescriptor` as a data source to produce `Intermediate`
items.
"""
Intermediate = namedtuple('Intermediate', 'track_content track_tags track_comment_tags '
'clip_content clip_tags clip_tag_mode start finish')
@@ -26,6 +30,9 @@ class TagCompiler:
session: doc_entity.SessionDescriptor
def compile_all_time_spans(self) -> List[Tuple[str, str, Fraction, Fraction]]:
"""
:returns: A `List` of (key: str, value: str, start: Fraction, finish: Fraction)
"""
ret_list = list()
for element in self.parse_data():
if element.clip_tag_mode == TagPreModes.TIMESPAN:

View File

@@ -36,11 +36,11 @@ def table_for_scene(scene, tc_format, font_name = 'Helvetica'):
def output_report(scenes: List[Tuple[str, str, Fraction, Fraction]],
tc_display_format: TimecodeFormat,
title: str, client: str, supervisor):
title: str, client: str, supervisor, paper_size = letter):
filename = "%s Continuity.pdf" % title
document_header = "Continuity"
doc = make_doc_template(page_size=portrait(letter),
doc = make_doc_template(page_size=portrait(paper_size),
filename=filename,
document_title="Continuity",
title=title,