Skip to content

Instantly share code, notes, and snippets.

@matbur
Created January 28, 2017 18:35
Show Gist options
  • Save matbur/73e6452ae21dc9e0edff8028e06a2b55 to your computer and use it in GitHub Desktop.
Save matbur/73e6452ae21dc9e0edff8028e06a2b55 to your computer and use it in GitHub Desktop.
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