def stationButtonPressed(self): stationSelected = GPIO.input(ROTARY_PIN_BUTTON) if(stationSelected and self.lastLedPos != self.ledPos): self.lastLedPos = self.ledPos mpc.loadPlaylist() mpc.sysCmd('mpc play ' + str(self.ledPos+1)) self.updateLeds()
def radioControl(action): if(action == 'load'): mpc.loadPlaylist() else: mpc.sysCmd('mpc ' + action) time.sleep(SETTINGS_STATION_READ_WAIT) return mpc.sysCmd('mpc current')
import gmusic_rest import threading import ConfigParser from bottle import route, run from radio_control import RadioControl radioConfigFile = "radio.ini" config = ConfigParser.RawConfigParser() config.read(radioConfigFile) # Server Settings SETTING_SERVER_IP = config.get('HttpServer', 'server_host') SETTING_SERVER_PORT = int(config.get('HttpServer', 'server_port')) # Start mpc/mpd mpc.loadPlaylist() mpc.sysCmd('mpc play') # Radio Control control = RadioControl() control.setDaemon(True) control.start() # Exit listener for the player def goodbye(): print "Terminating Radio Server" print "Stopping GMusic REST Player" gmusic_rest.exit() print "Stopping Radio Control" control.stop()