mirror of
https://github.com/iluvcapra/ptulsconv.git
synced 2025-12-31 08:50:48 +00:00
Refactoring
This commit is contained in:
@@ -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
|
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):
|
def dump_field_map(output=sys.stdout):
|
||||||
from ptulsconv.docparser.tag_mapping import TagMapping
|
from ptulsconv.docparser.tag_mapping import TagMapping
|
||||||
from ptulsconv.docparser.adr_entity import ADRLine, GenericEvent
|
from ptulsconv.docparser.adr_entity import ADRLine, GenericEvent
|
||||||
|
|||||||
@@ -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,
|
output_continuity(scenes=scenes, tc_display_format=session_tc_format,
|
||||||
title=title, client=client, supervisor=supervisor)
|
title=title, client=client, supervisor=supervisor)
|
||||||
|
|
||||||
# reels = sorted([r for r in compiler.compile_all_time_spans() if r[0] == 'Reel'],
|
# reels = sorted([r for r in compiler.compile_all_time_spans() if r[0] == 'Reel'],
|
||||||
# key=lambda x: x[2])
|
# key=lambda x: x[2])
|
||||||
reels = ['R1', 'R2', 'R3', 'R4', 'R5', 'R6']
|
reels = ['R1', 'R2', 'R3', 'R4', 'R5', 'R6']
|
||||||
|
|
||||||
if len(adr_lines) == 0:
|
if len(adr_lines) == 0:
|
||||||
@@ -197,7 +197,7 @@ def convert(input_file, major_mode, output=sys.stdout, warnings=True):
|
|||||||
if warnings:
|
if warnings:
|
||||||
perform_adr_validations(adr_lines)
|
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]):
|
def perform_adr_validations(lines : Iterator[ADRLine]):
|
||||||
|
|||||||
@@ -19,6 +19,10 @@ class Event:
|
|||||||
|
|
||||||
|
|
||||||
class TagCompiler:
|
class TagCompiler:
|
||||||
|
"""
|
||||||
|
Uses a `SessionDescriptor` as a data source to produce `Intermediate`
|
||||||
|
items.
|
||||||
|
"""
|
||||||
|
|
||||||
Intermediate = namedtuple('Intermediate', 'track_content track_tags track_comment_tags '
|
Intermediate = namedtuple('Intermediate', 'track_content track_tags track_comment_tags '
|
||||||
'clip_content clip_tags clip_tag_mode start finish')
|
'clip_content clip_tags clip_tag_mode start finish')
|
||||||
@@ -26,6 +30,9 @@ class TagCompiler:
|
|||||||
session: doc_entity.SessionDescriptor
|
session: doc_entity.SessionDescriptor
|
||||||
|
|
||||||
def compile_all_time_spans(self) -> List[Tuple[str, str, Fraction, Fraction]]:
|
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()
|
ret_list = list()
|
||||||
for element in self.parse_data():
|
for element in self.parse_data():
|
||||||
if element.clip_tag_mode == TagPreModes.TIMESPAN:
|
if element.clip_tag_mode == TagPreModes.TIMESPAN:
|
||||||
|
|||||||
@@ -36,11 +36,11 @@ def table_for_scene(scene, tc_format, font_name = 'Helvetica'):
|
|||||||
|
|
||||||
def output_report(scenes: List[Tuple[str, str, Fraction, Fraction]],
|
def output_report(scenes: List[Tuple[str, str, Fraction, Fraction]],
|
||||||
tc_display_format: TimecodeFormat,
|
tc_display_format: TimecodeFormat,
|
||||||
title: str, client: str, supervisor):
|
title: str, client: str, supervisor, paper_size = letter):
|
||||||
filename = "%s Continuity.pdf" % title
|
filename = "%s Continuity.pdf" % title
|
||||||
document_header = "Continuity"
|
document_header = "Continuity"
|
||||||
|
|
||||||
doc = make_doc_template(page_size=portrait(letter),
|
doc = make_doc_template(page_size=portrait(paper_size),
|
||||||
filename=filename,
|
filename=filename,
|
||||||
document_title="Continuity",
|
document_title="Continuity",
|
||||||
title=title,
|
title=title,
|
||||||
|
|||||||
Reference in New Issue
Block a user