import subprocess
import time
devices = ‘adb devices’
pi = subprocess.Popen(devices, shell=True, stdout=subprocess.PIPE)
print(pi.stdout.read())
while True:
screencap = r"adb shell screencap -p >%s.png" % time.strftime(‘%H:%M:%S’, time.localtime(time.time()))
pi = subprocess.Popen(screencap, shell=True, stdout=subprocess.PIPE)
pi.wait()
slide = ‘adb shell input swipe 1079 2000 1079 1000’
pi = subprocess.Popen(slide, shell=True, stdout=subprocess.PIPE)
pi.wait()
time.sleep(2)