Skip to content

Instantly share code, notes, and snippets.

@timothyclemans
Created April 25, 2014 17:40
Show Gist options
  • Save timothyclemans/11297452 to your computer and use it in GitHub Desktop.
Save timothyclemans/11297452 to your computer and use it in GitHub Desktop.
import os
import os
import signal
import subprocess
import shlex
#!/usr/bin/env python
import signal
import sys
def signal_handler(signal, frame):
#os.killpg(pro.pid, signal.SIGTERM)
p.kill()
os.system('adb shell am start -a android.intent.action.VIEW -d com.glass.videoglass:// --ez stopFromWS true')
print 'pulling screen.mp4'
os.system('adb pull /sdcard/VideoBlack/screen.mp4 screen.mp4')
print 'pulling video'
videofile = os.popen('adb shell "ls /sdcard/VideoBlack/" | tail -1').read()
videofile = videofile.strip()
print "adb pull /sdcard/VideoBlack/%s video.mp4" % (videofile)
os.system("adb pull /sdcard/VideoBlack/%s video.mp4" % (videofile))
sys.exit(0)
signal.signal(signal.SIGINT, signal_handler)
os.system('adb shell am start -a android.intent.action.VIEW -d com.glass.videoglass:// --ez startFromWS true')
cmd = "adb shell screenrecord /sdcard/VideoBlack/screen.mp4"
# The os.setsid() is passed in the argument preexec_fn so
# it's run after the fork() and before exec() to run the shell.
args = shlex.split(cmd)
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
#pro = subprocess.Popen(cmd, stdout=subprocess.PIPE,
# shell=True, preexec_fn=os.setsid)
signal.pause()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment