mirror of
https://github.com/iluvcapra/ptulsconv.git
synced 2025-12-31 08:50:48 +00:00
Implement field map option
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
from ptulsconv.commands import convert
|
||||
from ptulsconv.commands import convert, dump_field_map
|
||||
from optparse import OptionParser
|
||||
import sys
|
||||
|
||||
@@ -14,11 +14,20 @@ def main():
|
||||
parser.add_option('-m', '--include-muted', default=False, action='store_true', dest='include_muted',
|
||||
help='Read muted clips.')
|
||||
|
||||
parser.add_option('--show-tags', dest='show_tags',
|
||||
action='store_true',
|
||||
default=False, help='Display tag mappings for the FMP XML output style and exit.')
|
||||
|
||||
(options, args) = parser.parse_args(sys.argv)
|
||||
|
||||
if options.show_tags:
|
||||
dump_field_map('ADR')
|
||||
sys.exit(0)
|
||||
|
||||
if len(args) < 2:
|
||||
print("Error: No input file", file=sys.stderr)
|
||||
parser.print_help(sys.stderr)
|
||||
sys.exit(-1)
|
||||
sys.exit(22)
|
||||
|
||||
convert(input_file=args[1], start=options.in_time, end=options.out_time, include_muted=options.include_muted,
|
||||
progress=options.show_progress, output=sys.stdout)
|
||||
|
||||
@@ -99,12 +99,12 @@ def dump_field_map(field_map_name, output=sys.stdout):
|
||||
output.write("# ADR Table Fields\n")
|
||||
|
||||
output.write("# \n")
|
||||
output.write("# Tag Name | FMPXMLRESULT Column | Type \n")
|
||||
output.write("# -------------------------+----------------------+---------\n")
|
||||
output.write("# Tag Name | FMPXMLRESULT Column | Type | Column \n")
|
||||
output.write("# -------------------------+----------------------+---------+--------\n")
|
||||
|
||||
for field in field_map:
|
||||
for n, field in enumerate(field_map):
|
||||
for tag in field[0]:
|
||||
output.write("# %25s| %20s | %8s\n" % (tag[:25], field[1][:20], field[2].__name__))
|
||||
output.write("# %-24s-> %-20s | %-8s| %-7i\n" % (tag[:24], field[1][:20], field[2].__name__, n+1 ))
|
||||
|
||||
|
||||
def convert(input_file, output_format='fmpxml', start=None, end=None, progress=False, include_muted=False,
|
||||
|
||||
Reference in New Issue
Block a user