Skip to content

Instantly share code, notes, and snippets.

@Neoklosch
Created February 17, 2016 15:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Neoklosch/a5da9729283dfc37d0ba to your computer and use it in GitHub Desktop.
Save Neoklosch/a5da9729283dfc37d0ba to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import subprocess, time, json
import urllib2
def main():
print "Starting notifier..."
message = ["notify-send", "Deine Nummer Digga, geh los!"]
while True:
current_number = your_number()
if current_number in (689, 690, 691):
subprocess.call(message)
else:
print current_number
time.sleep(2)
print "Closing notifier..."
def your_number():
api_url = 'http://pa.freitagsrunde.org/api/'
content = urllib2.urlopen(api_url).read()
json_content = json.loads(content)
for item in json_content['entries']:
if item['src'] == 23:
numbers = item['numbers']
for number in numbers:
if number['src'] == "23":
current_number = number['num']
return current_number
return -1
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment