Created
October 23, 2017 14:43
-
-
Save denizozger/9b6dc105ddf252ae465136fadb16fd26 to your computer and use it in GitHub Desktop.
This file contains 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
# 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