mirror of
https://github.com/iluvcapra/ptulsconv.git
synced 2025-12-31 08:50:48 +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">
|
||||
<words>
|
||||
<w>adlib</w>
|
||||
<w>bottompadding</w>
|
||||
<w>fmpxml</w>
|
||||
<w>futura</w>
|
||||
<w>leftpadding</w>
|
||||
<w>ptulsconv</w>
|
||||
<w>retval</w>
|
||||
<w>smpte</w>
|
||||
|
||||
@@ -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!
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import ffmpeg # ffmpeg-python
|
||||
|
||||
# TODO: Implement movie export
|
||||
|
||||
# def create_movie(event):
|
||||
# start = event['Movie.Start_Offset_Seconds']
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
sys.stderr.write("\n%s\n" % message)
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user