Last active
July 28, 2016 20:08
-
-
Save jeffcrouse/2952ecec849179cf0a09996c53707b8f 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
import subprocess | |
import time | |
# Written to run on a Raspberry Pi with an Adafruit PiTFT or similar | |
# https://www.instagram.com/p/BIavjvSBYE6/ | |
# Be sure to `sudo apt-get install speedtest-cli` before running this | |
# Save this script to your home directory and add "sudo python /home/pi/speedtest.py &" | |
# to /etc/rc.local so that it starts automatically on boot | |
time.sleep(60) # Wait for everything to start up. | |
while True: | |
output = subprocess.check_output(['speedtest-cli', '--share']) | |
print output | |
parts = output.split(" ") | |
url = parts.pop().strip(); | |
print "downloading "+url | |
subprocess.call(['wget', '-P', '/home/pi/Pictures/', url]) | |
parts = url.split('/') | |
path = "/home/pi/Pictures/" + parts.pop() | |
print "displaying "+path | |
cmd = ['sudo', 'fbi', '-T', '1', '-d', '/dev/fb1', '-noverbose', '-a', path] | |
print cmd | |
subprocess.call(cmd) | |
time.sleep(60 * 5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment