|
|
@@ -262,8 +262,9 @@ class Cmdline(object): |
|
|
|
if not os.path.exists(filename): |
|
|
|
self.die("Error opening input file %s\n", filename) |
|
|
|
try: |
|
|
|
# zcat is much faster than python's gzopen. |
|
|
|
# We've checked that the file already exists |
|
|
|
# zcat is much faster than python's gzopen. We've |
|
|
|
# checked that the file existed, so this isn't too |
|
|
|
# likely to fail |
|
|
|
process = subprocess.Popen(["zcat", "-f", filename], |
|
|
|
bufsize = -1, |
|
|
|
stdin = open(os.devnull), |
|
|
@@ -284,11 +285,18 @@ class Cmdline(object): |
|
|
|
except KeyError: |
|
|
|
self.die("Need to specify --rate\n") |
|
|
|
|
|
|
|
# These will die if they can't parse |
|
|
|
if self.args.start: |
|
|
|
start = self.parse_time(self.args.start) |
|
|
|
try: |
|
|
|
start = self.parse_time(self.args.start) |
|
|
|
except ValueError: |
|
|
|
self.die("Error parsing start time '%s'\n", |
|
|
|
self.args.start) |
|
|
|
else: |
|
|
|
start = self.parse_time(filename) |
|
|
|
try: |
|
|
|
start = self.parse_time(filename) |
|
|
|
except ValueError: |
|
|
|
self.die("Error extracting time from filename '%s'\n", |
|
|
|
filename) |
|
|
|
|
|
|
|
ts = nilmdb.timestamper.TimestamperRate(infile, start, rate) |
|
|
|
|
|
|
@@ -298,3 +306,6 @@ class Cmdline(object): |
|
|
|
print "Rate:", rate |
|
|
|
|
|
|
|
self.die("not implemented") |
|
|
|
|
|
|
|
def parse_time(self, time): |
|
|
|
raise ValueError("go away") |