mirror of
https://github.com/iluvcapra/ptulsconv.git
synced 2025-12-31 08:50:48 +00:00
Added command interface
This commit is contained in:
23
ptulsconv/__main__.py
Normal file
23
ptulsconv/__main__.py
Normal file
@@ -0,0 +1,23 @@
|
||||
from ptulsconv.commands import convert
|
||||
from optparse import OptionParser
|
||||
import sys
|
||||
|
||||
parser = OptionParser()
|
||||
parser.add_option('-t','--timecode', dest='convert_times', default=False, action='store_true',
|
||||
help="Include timecode converted to seconds in output.")
|
||||
parser.add_option('-z','--offset', dest='apply_start_offset', default=False, action='store_true',
|
||||
help='Apply session start offset to converted start and finish timecodes on '
|
||||
'clips and markers. Implies -t.')
|
||||
parser.usage = "ptulsconv [-tz] TEXT_EXPORT.txt"
|
||||
|
||||
if __name__ == "__main__":
|
||||
(options, args) = parser.parse_args(sys.argv)
|
||||
if len(args) < 2:
|
||||
print("Error: No input file",file=sys.stderr)
|
||||
parser.print_help(sys.stderr)
|
||||
exit(-1)
|
||||
|
||||
convert(input_file=args[1],
|
||||
convert_times=(options.convert_times or options.apply_start_offset),
|
||||
apply_session_start=options.apply_start_offset,
|
||||
output=sys.stdout)
|
||||
@@ -16,6 +16,3 @@ def convert(input_file, convert_times, apply_session_start, output=sys.stdout):
|
||||
|
||||
json.dump(parsed, output)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
7
setup.py
7
setup.py
@@ -24,5 +24,10 @@ setup(name='ptulsconv',
|
||||
"Programming Language :: Python :: 3.7"],
|
||||
packages=['ptulsconv'],
|
||||
keywords='text-processing parsers film tv editing editorial',
|
||||
install_requires=['parsimonious', 'timecode']
|
||||
install_requires=['parsimonious', 'timecode'],
|
||||
entry_points={
|
||||
'console_scripts': [
|
||||
'ptulsconv = ptulsconv.__main__:main'
|
||||
]
|
||||
}
|
||||
)
|
||||
Reference in New Issue
Block a user