mirror of
https://github.com/iluvcapra/ptulsconv.git
synced 2025-12-31 17:00:46 +00:00
Surveyed TODOs and style
This commit is contained in:
2
.idea/dictionaries/jamie.xml
generated
2
.idea/dictionaries/jamie.xml
generated
@@ -2,8 +2,10 @@
|
|||||||
<dictionary name="jamie">
|
<dictionary name="jamie">
|
||||||
<words>
|
<words>
|
||||||
<w>adlib</w>
|
<w>adlib</w>
|
||||||
|
<w>bottompadding</w>
|
||||||
<w>fmpxml</w>
|
<w>fmpxml</w>
|
||||||
<w>futura</w>
|
<w>futura</w>
|
||||||
|
<w>leftpadding</w>
|
||||||
<w>ptulsconv</w>
|
<w>ptulsconv</w>
|
||||||
<w>retval</w>
|
<w>retval</w>
|
||||||
<w>smpte</w>
|
<w>smpte</w>
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
# ptulsconv
|
# ptulsconv
|
||||||
Read Pro Tools text exports and generate JSON, PDF reports.
|
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.
|
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!
|
New features and much better reporting, including native PDF reports, are coming soon!
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ from ptulsconv import __name__, __version__, __author__
|
|||||||
from ptulsconv.commands import convert, dump_field_map
|
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
|
from ptulsconv.reporting import print_status_style, print_banner_style, print_section_header_style, print_fatal_error
|
||||||
|
|
||||||
|
#TODO: Support Top-level modes
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = OptionParser()
|
parser = OptionParser()
|
||||||
|
|||||||
@@ -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)
|
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:
|
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.
|
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
|
: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
|
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.
|
`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]
|
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):
|
def frame_count_to_footage(frame_count):
|
||||||
feet, frm = divmod(frame_count, 16)
|
feet, frm = divmod(frame_count, 16)
|
||||||
return "%i+%02i" % (feet, frm)
|
return "%i+%02i" % (feet, frm)
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import ffmpeg # ffmpeg-python
|
import ffmpeg # ffmpeg-python
|
||||||
|
|
||||||
|
# TODO: Implement movie export
|
||||||
|
|
||||||
# def create_movie(event):
|
# def create_movie(event):
|
||||||
# start = event['Movie.Start_Offset_Seconds']
|
# start = event['Movie.Start_Offset_Seconds']
|
||||||
|
|||||||
@@ -10,6 +10,9 @@ from reportlab.pdfbase.ttfonts import TTFont
|
|||||||
|
|
||||||
from ptulsconv.docparser.adr_entity import ADRLine
|
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
|
# This is from https://code.activestate.com/recipes/576832/ for
|
||||||
# generating page count messages
|
# generating page count messages
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ from reportlab.platypus import Table, Paragraph
|
|||||||
from reportlab.lib.styles import getSampleStyleSheet
|
from reportlab.lib.styles import getSampleStyleSheet
|
||||||
|
|
||||||
from .__init__ import time_format, make_doc_template
|
from .__init__ import time_format, make_doc_template
|
||||||
from ..broadcast_timecode import TimecodeFormat
|
|
||||||
from ..docparser.adr_entity import ADRLine
|
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({
|
columns.append({
|
||||||
'heading': n,
|
'heading': n,
|
||||||
'value_getter': lambda recs, n1=n: len([r for r in recs if r.reel == n1]),
|
'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
|
'value_getter2': lambda recs, n1=n: time_format(sum([r.time_budget_mins or 0. for r
|
||||||
if r.reel == n1])),
|
in recs if r.reel == n1])),
|
||||||
'style_getter': lambda col_index: [('ALIGN', (col_index, 0), (col_index, -1), 'CENTER'),
|
'style_getter': lambda col_index: [('ALIGN', (col_index, 0), (col_index, -1), 'CENTER'),
|
||||||
('LINEAFTER', (col_index, 0), (col_index, -1), .5, colors.gray)],
|
('LINEAFTER', (col_index, 0), (col_index, -1), .5, colors.gray)],
|
||||||
'width': num_column_width
|
'width': num_column_width
|
||||||
@@ -133,7 +132,8 @@ def build_columns(lines: List[ADRLine], reel_list: Optional[List[str]], show_pri
|
|||||||
return columns
|
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()
|
data = list()
|
||||||
styles = list()
|
styles = list()
|
||||||
columns_widths = list()
|
columns_widths = list()
|
||||||
@@ -187,8 +187,8 @@ def populate_columns(lines: List[ADRLine], columns, include_omitted, page_size):
|
|||||||
return data, styles, columns_widths
|
return data, styles, columns_widths
|
||||||
|
|
||||||
|
|
||||||
def build_header(column_widths):
|
# def build_header(column_widths):
|
||||||
pass
|
# pass
|
||||||
|
|
||||||
|
|
||||||
def output_report(lines: List[ADRLine], reel_list: List[str], include_omitted=False,
|
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],
|
record=lines[0],
|
||||||
document_header='Line Count')
|
document_header='Line Count')
|
||||||
|
|
||||||
#header_data, header_style, header_widths = build_header(columns_widths)
|
# header_data, header_style, header_widths = build_header(columns_widths)
|
||||||
#header_table = Table(data=header_data, style=header_style, colWidths=header_widths)
|
# header_table = Table(data=header_data, style=header_style, colWidths=header_widths)
|
||||||
|
|
||||||
table = Table(data=data, style=style, colWidths=columns_widths)
|
table = Table(data=data, style=style, colWidths=columns_widths)
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,4 @@
|
|||||||
from reportlab.pdfgen.canvas import Canvas
|
# TODO: Complete Recordist Log
|
||||||
|
|
||||||
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
|
|
||||||
|
|
||||||
|
|
||||||
def output_report(records):
|
def output_report(records):
|
||||||
# order by start
|
# order by start
|
||||||
|
|||||||
@@ -229,7 +229,7 @@ def create_report_for_character(records, report_date, tc_display_format: Timecod
|
|||||||
# FIXME: Draw the title
|
# FIXME: Draw the title
|
||||||
# TODO: Integrate this report into the common DocTemplate api
|
# 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_character_row(c, char_row, record)
|
||||||
draw_cue_number_block(c, cue_number_block, record)
|
draw_cue_number_block(c, cue_number_block, record)
|
||||||
draw_timecode_block(c, timecode_block, record, tc_display_format=tc_display_format)
|
draw_timecode_block(c, timecode_block, record, tc_display_format=tc_display_format)
|
||||||
|
|||||||
@@ -1,23 +1,25 @@
|
|||||||
import sys
|
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():
|
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:
|
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():
|
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:
|
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):
|
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))
|
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:
|
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:
|
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:
|
else:
|
||||||
sys.stderr.write("\n")
|
sys.stderr.write("\n")
|
||||||
sys.stderr.write(" ! Tagging error: \"%s\"\n" % failed_string)
|
sys.stderr.write(" ! Tagging error: \"%s\"\n" % failed_string)
|
||||||
sys.stderr.write(" ! %s _______________⬆\n" % (" " * position))
|
sys.stderr.write(" ! %s _______________⬆\n" % (" " * position))
|
||||||
|
|
||||||
if parent_track_name is not None:
|
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:
|
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")
|
sys.stderr.write("\n")
|
||||||
|
|
||||||
def print_fatal_error(str):
|
|
||||||
|
def print_fatal_error(message):
|
||||||
if sys.stderr.isatty():
|
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:
|
else:
|
||||||
sys.stderr.write("\n%s\n" % str)
|
sys.stderr.write("\n%s\n" % message)
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from ptulsconv.docparser.adr_entity import ADRLine
|
from ptulsconv.docparser.adr_entity import ADRLine
|
||||||
from typing import List, Iterator, Optional
|
from typing import Iterator, Optional
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class ValidationError:
|
class ValidationError:
|
||||||
message: str
|
message: str
|
||||||
event: Optional[ADRLine]
|
event: Optional[ADRLine] = None
|
||||||
|
|
||||||
def report_message(self):
|
def report_message(self):
|
||||||
if self.event is not None:
|
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])
|
message = message + "\n - {} -> {}".format(u[0], u[1])
|
||||||
|
|
||||||
yield ValidationError(message=message, event=None)
|
yield ValidationError(message=message, event=None)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ from typing import List
|
|||||||
import ptulsconv
|
import ptulsconv
|
||||||
from ptulsconv.docparser.adr_entity import ADRLine
|
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):
|
def avid_marker_list(lines: List[ADRLine], report_date=datetime.datetime.now(), reel_start_frame=0, fps=24):
|
||||||
doc = TreeBuilder(element_factory=None)
|
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('2', "OMFI:ATTB:StringAttribute", 'string', '_ATN_CRM_TRK', 'V1')
|
||||||
insert_elem('1', "OMFI:ATTB:IntAttribute", 'int32', '_ATN_CRM_LENGTH', '1')
|
insert_elem('1', "OMFI:ATTB:IntAttribute", 'int32', '_ATN_CRM_LENGTH', '1')
|
||||||
|
|
||||||
doc.start('ListElem')
|
doc.start('ListElem', {})
|
||||||
doc.end('ListElem')
|
doc.end('ListElem')
|
||||||
|
|
||||||
doc.end('List')
|
doc.end('List')
|
||||||
|
|||||||
Reference in New Issue
Block a user