Skip to content

Instantly share code, notes, and snippets.

@denizozger
Created October 23, 2017 14:43
Show Gist options
  • Save denizozger/9b6dc105ddf252ae465136fadb16fd26 to your computer and use it in GitHub Desktop.
Save denizozger/9b6dc105ddf252ae465136fadb16fd26 to your computer and use it in GitHub Desktop.
# Run this in conjunction with https://github.com/jishi/node-sonos-http-api
import urllib.request
import json
import time
BANNED_ARTISTS = ['drake']
while True:
state = json.loads(urllib.request.urlopen("http://localhost:5005/state").read().decode('utf-8'))
artist = state['currentTrack']['artist'].lower()
if any(artist in s for s in BANNED_ARTISTS):
print("%s is not allowed in this place" % artist)
urllib.request.urlopen("http://localhost:5005/next")
time.sleep(2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment