def ping(IP_DEVICE, connected): print("ping ", IP_DEVICE) proc = subprocess.Popen(["ping", IP_DEVICE], stdout=subprocess.PIPE) found = False while True: line = proc.stdout.readline() if not line: break line = line.decode("utf-8") # condizione bruttissima ma per ora è l'unica idea che ho avuto if line.find("Tempo") != -1: found = True if not connected: connected = True status(connected) play() break if not found: connected = False status(connected) pause() return connected
def nextHandler(): spotify.pause() spotify.next() json = spotify.currentTrack() spotify.play() return json
def pauseHandler(): spotify.pause() return spotify.currentTrack()
def previousHandler(): spotify.pause() spotify.previous() json = spotify.currentTrack() spotify.play() return json