Created
January 28, 2017 18:35
-
-
Save matbur/73e6452ae21dc9e0edff8028e06a2b55 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 requests | |
import subprocess | |
from time import sleep | |
from random import randrange | |
from datetime import datetime | |
i = 0 | |
def get_content(): | |
global i | |
r = requests.get('http://www.zio.iiar.pwr.wroc.pl/pea/?C=M;O=D') | |
print(i, datetime.now(), r) | |
i += 1 | |
return r.text | |
def main(): | |
t = get_content() | |
while 1: | |
sleep(30 + randrange(30)) | |
t2 = get_content() | |
if t2 != t: | |
break | |
subprocess.check_output(['vlc', 'music.mp3']) | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment