diff --git a/.idea/dictionaries/jamie.xml b/.idea/dictionaries/jamie.xml index b8761aa..63cbafe 100644 --- a/.idea/dictionaries/jamie.xml +++ b/.idea/dictionaries/jamie.xml @@ -2,8 +2,10 @@ adlib + bottompadding fmpxml futura + leftpadding ptulsconv retval smpte diff --git a/README.md b/README.md index 14ce8bc..8c83f3a 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ # ptulsconv Read Pro Tools text exports and generate JSON, PDF reports. -## Notice +## Notice! At this time there are a lot of changes in the HEAD of this package and you should use the last posted Pypi package. New features and much better reporting, including native PDF reports, are coming soon! diff --git a/ptulsconv/__main__.py b/ptulsconv/__main__.py index 94fb7e5..757ebcb 100644 --- a/ptulsconv/__main__.py +++ b/ptulsconv/__main__.py @@ -7,6 +7,7 @@ from ptulsconv import __name__, __version__, __author__ from ptulsconv.commands import convert, dump_field_map from ptulsconv.reporting import print_status_style, print_banner_style, print_section_header_style, print_fatal_error +#TODO: Support Top-level modes def main(): parser = OptionParser() diff --git a/ptulsconv/broadcast_timecode.py b/ptulsconv/broadcast_timecode.py index 6397e6e..46bbc78 100644 --- a/ptulsconv/broadcast_timecode.py +++ b/ptulsconv/broadcast_timecode.py @@ -15,10 +15,6 @@ class TimecodeFormat(namedtuple("_TimecodeFormat", "frame_duration logical_fps d return frame_count_to_smpte(frame_count, self.logical_fps, self.drop_frame) - - - - def smpte_to_frame_count(smpte_rep_string: str, frames_per_logical_second: int, drop_frame_hint=False) -> int: """ Convert a string with a SMPTE timecode representation into a frame count. @@ -29,7 +25,6 @@ def smpte_to_frame_count(smpte_rep_string: str, frames_per_logical_second: int, :param drop_frame_hint: `True` 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. - :param include_fractional: If `True` fractional frames will be parsed and returned as a second retval in a tuple """ assert frames_per_logical_second in [24, 25, 30, 48, 50, 60] @@ -98,5 +93,3 @@ def footage_to_frame_count(footage_string): def frame_count_to_footage(frame_count): feet, frm = divmod(frame_count, 16) return "%i+%02i" % (feet, frm) - - diff --git a/ptulsconv/movie_export.py b/ptulsconv/movie_export.py index dbc1c51..c104ad6 100644 --- a/ptulsconv/movie_export.py +++ b/ptulsconv/movie_export.py @@ -1,5 +1,6 @@ import ffmpeg # ffmpeg-python +# TODO: Implement movie export # def create_movie(event): # start = event['Movie.Start_Offset_Seconds'] diff --git a/ptulsconv/pdf/__init__.py b/ptulsconv/pdf/__init__.py index 99f2bcf..2c8a596 100644 --- a/ptulsconv/pdf/__init__.py +++ b/ptulsconv/pdf/__init__.py @@ -10,6 +10,9 @@ from reportlab.pdfbase.ttfonts import TTFont from ptulsconv.docparser.adr_entity import ADRLine +#TODO: A Generic report useful for spotting +#TODO: A report useful for M&E mixer's notes +#TODO: Address all style notes this file # This is from https://code.activestate.com/recipes/576832/ for # generating page count messages diff --git a/ptulsconv/pdf/line_count.py b/ptulsconv/pdf/line_count.py index a016385..d3c2aae 100644 --- a/ptulsconv/pdf/line_count.py +++ b/ptulsconv/pdf/line_count.py @@ -11,7 +11,6 @@ from reportlab.platypus import Table, Paragraph from reportlab.lib.styles import getSampleStyleSheet from .__init__ import time_format, make_doc_template -from ..broadcast_timecode import TimecodeFormat from ..docparser.adr_entity import ADRLine @@ -53,8 +52,8 @@ def build_columns(lines: List[ADRLine], reel_list: Optional[List[str]], show_pri columns.append({ 'heading': n, 'value_getter': lambda recs, n1=n: len([r for r in recs if r.reel == n1]), - 'value_getter2': lambda recs, n1=n: time_format(sum([r.time_budget_mins or 0. for r in recs - if r.reel == n1])), + 'value_getter2': lambda recs, n1=n: time_format(sum([r.time_budget_mins or 0. for r + in recs if r.reel == n1])), 'style_getter': lambda col_index: [('ALIGN', (col_index, 0), (col_index, -1), 'CENTER'), ('LINEAFTER', (col_index, 0), (col_index, -1), .5, colors.gray)], 'width': num_column_width @@ -133,7 +132,8 @@ def build_columns(lines: List[ADRLine], reel_list: Optional[List[str]], show_pri return columns -def populate_columns(lines: List[ADRLine], columns, include_omitted, page_size): +def populate_columns(lines: List[ADRLine], columns, include_omitted, _page_size): + # TODO: use page_size parameter data = list() styles = list() columns_widths = list() @@ -187,8 +187,8 @@ def populate_columns(lines: List[ADRLine], columns, include_omitted, page_size): return data, styles, columns_widths -def build_header(column_widths): - pass +# def build_header(column_widths): +# pass def output_report(lines: List[ADRLine], reel_list: List[str], include_omitted=False, @@ -210,8 +210,8 @@ def output_report(lines: List[ADRLine], reel_list: List[str], include_omitted=Fa record=lines[0], document_header='Line Count') - #header_data, header_style, header_widths = build_header(columns_widths) - #header_table = Table(data=header_data, style=header_style, colWidths=header_widths) + # header_data, header_style, header_widths = build_header(columns_widths) + # header_table = Table(data=header_data, style=header_style, colWidths=header_widths) table = Table(data=data, style=style, colWidths=columns_widths) diff --git a/ptulsconv/pdf/recordist_log.py b/ptulsconv/pdf/recordist_log.py index 70e2e9c..fc93317 100644 --- a/ptulsconv/pdf/recordist_log.py +++ b/ptulsconv/pdf/recordist_log.py @@ -1,18 +1,4 @@ -from reportlab.pdfgen.canvas import Canvas - -from reportlab.pdfbase import pdfmetrics -from reportlab.pdfbase.ttfonts import TTFont - -from reportlab.lib.units import inch -from reportlab.lib.pagesizes import letter - -from reportlab.lib.styles import getSampleStyleSheet -from reportlab.platypus import Paragraph - -from .__init__ import GRect - -import datetime - +# TODO: Complete Recordist Log def output_report(records): # order by start diff --git a/ptulsconv/pdf/supervisor_1pg.py b/ptulsconv/pdf/supervisor_1pg.py index 8a00000..1b7e015 100644 --- a/ptulsconv/pdf/supervisor_1pg.py +++ b/ptulsconv/pdf/supervisor_1pg.py @@ -229,7 +229,7 @@ def create_report_for_character(records, report_date, tc_display_format: Timecod # FIXME: Draw the title # TODO: Integrate this report into the common DocTemplate api - #draw_title_box(c, title_header_block, record) + # draw_title_box(c, title_header_block, record) draw_character_row(c, char_row, record) draw_cue_number_block(c, cue_number_block, record) draw_timecode_block(c, timecode_block, record, tc_display_format=tc_display_format) diff --git a/ptulsconv/reporting.py b/ptulsconv/reporting.py index 44e351b..d07d993 100644 --- a/ptulsconv/reporting.py +++ b/ptulsconv/reporting.py @@ -1,23 +1,25 @@ import sys -def print_banner_style(str): - if sys.stderr.isatty(): - sys.stderr.write("\n\033[1m%s\033[0m\n\n" % str) - else: - sys.stderr.write("\n%s\n\n" % str) -def print_section_header_style(str): +def print_banner_style(message): if sys.stderr.isatty(): - sys.stderr.write("\n\033[4m%s\033[0m\n\n" % str) + sys.stderr.write("\n\033[1m%s\033[0m\n\n" % message) else: - sys.stderr.write("%s\n\n" % str) + sys.stderr.write("\n%s\n\n" % message) -def print_status_style(str): +def print_section_header_style(message): if sys.stderr.isatty(): - sys.stderr.write("\033[3m - %s\033[0m\n" % str) + sys.stderr.write("\n\033[4m%s\033[0m\n\n" % message) else: - sys.stderr.write(" - %s\n" % str) + sys.stderr.write("%s\n\n" % message) + + +def print_status_style(message): + if sys.stderr.isatty(): + sys.stderr.write("\033[3m - %s\033[0m\n" % message) + else: + sys.stderr.write(" - %s\n" % message) def print_warning(warning_string): @@ -36,25 +38,26 @@ def print_advisory_tagging_error(failed_string, position, parent_track_name=None sys.stderr.write("\033[32m\"%s\033[31;1m%s\"\033[0m\n" % (ok_string, not_ok_string)) if parent_track_name is not None: - sys.stderr.write(" ! > On track \"%s\"\n" % (parent_track_name)) + sys.stderr.write(" ! > On track \"%s\"\n" % parent_track_name) if clip_time is not None: - sys.stderr.write(" ! > In clip name at %s\n" % (clip_time)) + sys.stderr.write(" ! > In clip name at %s\n" % clip_time) else: sys.stderr.write("\n") sys.stderr.write(" ! Tagging error: \"%s\"\n" % failed_string) sys.stderr.write(" ! %s _______________⬆\n" % (" " * position)) if parent_track_name is not None: - sys.stderr.write(" ! > On track \"%s\"\n" % (parent_track_name)) + sys.stderr.write(" ! > On track \"%s\"\n" % parent_track_name) if clip_time is not None: - sys.stderr.write(" ! > In clip name at %s\n" % (clip_time)) + sys.stderr.write(" ! > In clip name at %s\n" % clip_time) sys.stderr.write("\n") -def print_fatal_error(str): + +def print_fatal_error(message): if sys.stderr.isatty(): - sys.stderr.write("\n\033[5;31;1m*** %s ***\033[0m\n" % str) + sys.stderr.write("\n\033[5;31;1m*** %s ***\033[0m\n" % message) else: - sys.stderr.write("\n%s\n" % str) \ No newline at end of file + sys.stderr.write("\n%s\n" % message) diff --git a/ptulsconv/validations.py b/ptulsconv/validations.py index 8096112..72e6fbe 100644 --- a/ptulsconv/validations.py +++ b/ptulsconv/validations.py @@ -1,12 +1,12 @@ from dataclasses import dataclass from ptulsconv.docparser.adr_entity import ADRLine -from typing import List, Iterator, Optional +from typing import Iterator, Optional @dataclass class ValidationError: message: str - event: Optional[ADRLine] + event: Optional[ADRLine] = None def report_message(self): if self.event is not None: @@ -62,7 +62,3 @@ def validate_dependent_value(input_lines: Iterator[ADRLine], key_field, dependen message = message + "\n - {} -> {}".format(u[0], u[1]) yield ValidationError(message=message, event=None) - - - - diff --git a/ptulsconv/xml/common.py b/ptulsconv/xml/common.py index f93c8a7..6e43677 100644 --- a/ptulsconv/xml/common.py +++ b/ptulsconv/xml/common.py @@ -11,7 +11,7 @@ from typing import List import ptulsconv from ptulsconv.docparser.adr_entity import ADRLine - +# TODO Get a third-party test for Avid Marker lists def avid_marker_list(lines: List[ADRLine], report_date=datetime.datetime.now(), reel_start_frame=0, fps=24): doc = TreeBuilder(element_factory=None) @@ -69,7 +69,7 @@ def avid_marker_list(lines: List[ADRLine], report_date=datetime.datetime.now(), insert_elem('2', "OMFI:ATTB:StringAttribute", 'string', '_ATN_CRM_TRK', 'V1') insert_elem('1', "OMFI:ATTB:IntAttribute", 'int32', '_ATN_CRM_LENGTH', '1') - doc.start('ListElem') + doc.start('ListElem', {}) doc.end('ListElem') doc.end('List')