Skip to content

Instantly share code, notes, and snippets.

@vpetersson
Last active June 12, 2017 19:43
Show Gist options
  • Save vpetersson/c17e519e9d4f51367525aaea310c7012 to your computer and use it in GitHub Desktop.
Save vpetersson/c17e519e9d4f51367525aaea310c7012 to your computer and use it in GitHub Desktop.
#!/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