#! /usr/bin/env python
import sys

import ubc_utils
import utils

if len(sys.argv) < 3:
    print("Usage: %s filename offsetframes")
    sys.exit()

nFrames = int(sys.argv[2])

def modifyLines(objectNum, lines):
    result = lines
    tmp = lines[0].split(" ")
    firstInstant = int(tmp[1])+nFrames
    lastInstant = int(tmp[2])+nFrames
    tmp[1] = str(firstInstant)
    tmp[2] = str(lastInstant)
    result[0] = " ".join(tmp)
    return result

ubc_utils.modifyTrajectoryFile(modifyLines, sys.argv[1], sys.argv[1]+".new")
