예제 #1
0
 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()
예제 #2
0
def radioControl(action):
    if(action ==  'load'):
        mpc.loadPlaylist()
    else:
        mpc.sysCmd('mpc ' + action)
	time.sleep(SETTINGS_STATION_READ_WAIT)
    return mpc.sysCmd('mpc current')
예제 #3
0
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()