Created
April 29, 2019 04:19
-
-
Save gteissier/9fa29cc50be5f26aa0741f14511634c1 to your computer and use it in GitHub Desktop.
Asciinema now stores timestamp from the start of the capture. To skip start of the capture, one needs to offset the timestamps from the first kept in the capture.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
import sys | |
import json | |
start_time = None | |
for line in sys.stdin.readlines(): | |
o = json.loads(line) | |
if type(o) != type([]): | |
sys.stdout.write(line) | |
else: | |
if not start_time: | |
start_time = o[0] | |
o[0] = o[0]-start_time | |
sys.stdout.write(json.dumps(o) + '\n') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment