Last active
June 12, 2017 19:43
-
-
Save vpetersson/c17e519e9d4f51367525aaea310c7012 to your computer and use it in GitHub Desktop.
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 flicklib | |
import subprocess | |
from time import sleep | |
from copy import copy | |
@flicklib.move() | |
def move(x, y, z): | |
global xyz | |
xyz = [x,y,z] | |
def main(): | |
global xyz | |
xyz = [0,0,0] | |
old_xyz = [0,0,0] | |
while True: | |
if old_xyz != xyz: | |
print 'Detected movement. Sending Bat-signal to Screenly!' | |
subprocess.call(['pkill', '-SIGUSR1', '-f', 'viewer.py']) | |
sleep(1) | |
old_xyz = copy(xyz) | |
sleep(0.3) | |
if __name__ == "__main__": | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment