Created
October 28, 2020 04:14
-
-
Save chr15m/915fa9ef94a4886b746ac80d76ae4d26 to your computer and use it in GitHub Desktop.
Python wrapper for byzanz-record to capture gifs
This file contains 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 | |
# You'll need to have `xrectsel` and `byzanz-record` installed | |
from __future__ import print_function | |
import re | |
import sys | |
import subprocess | |
if len(sys.argv) == 1: | |
print("You must supply at least a filename") | |
print(" -h for byzanz-record help") | |
else: | |
if sys.argv[1] == "-h": | |
print(subprocess.check_output(['byzanz-record', "--help"])) | |
else: | |
w,h,x,y = re.split("[+x]", subprocess.check_output(['xrectsel']).decode("utf8").rstrip("\n")) | |
args = ['byzanz-record', "-x", x, "-y", y, "-w", w, "-h", h] + sys.argv[1:] | |
print(" ".join(args)) | |
print(subprocess.check_output(args)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment