Skip to content
Snippets Groups Projects
Commit d550fc95 authored by Bruce Flynn's avatar Bruce Flynn
Browse files

Fix bug in CLI tool

parent f0c247e4
No related branches found
No related tags found
No related merge requests found
"""
Console script entry points for CLI tools.
"""
from datetime import datetime
import os
from edosl0util import split
......@@ -10,12 +10,8 @@ def cmd_split():
from argparse import ArgumentParser
parser = ArgumentParser(description=split.__doc__)
parser.add_argument('--minutes', type=int, default=6)
parser.add_argument('--output-format', default='%y%j%H%M%S001.PDS')
parser.add_argument('filepath')
args = parser.parse_args()
for time, offset, count, blob in split.split(open(args.filepath), args.minutes):
stamp = datetime.utcfromtimestamp(time)
filepath = stamp.strftime(args.output_format)
print("writing %d packets from offset %d to %s" % (count, offset, filepath))
open(filepath, 'wb', buffering=0).write(blob)
for stamp, fpath in split.split_file(args.filepath, args.minutes, os.getcwd()):
print('wrote bucket {} to {}'.format(stamp.isoformat(), fpath))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment