-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrecordSpeed.py
More file actions
25 lines (18 loc) · 766 Bytes
/
recordSpeed.py
File metadata and controls
25 lines (18 loc) · 766 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# Speeds up an asciinema recording (since you can't do that when recording in PowerSession).
# This probably doesn't need to be in the repository, but it's nice to have for other recordings I make for now.
def main():
with open('.\donut.tale.rec', 'r') as f:
lines = f.readlines()
speed = 5
for line in lines[1:]:
if line.strip() == '':
continue
originalSpeed = line.split('[')[1].split(",")[0].strip()
newSpeed = float(originalSpeed) / speed
newLine = line.replace(originalSpeed, str(newSpeed))
lines[lines.index(line)] = newLine
# Write the new lines to a new file
with open('.\donut.tale.speed.rec', 'w') as f:
f.writelines(lines)
if __name__ == '__main__':
main()