Esempio n. 1
0
    def button3(self):
        self.logger.info('Page 1 - Button 3 - Vol Down')
    
        pandoraUtils.writeToLCD("Volume", "Down")
        pandoraUtils.sendCommand('((((')

        pandoraUtils.parseAndWrite(2)
Esempio n. 2
0
    def button4(self):
        self.logger.info('Page 1 - Button 4 - Vol Up')

        pandoraUtils.writeToLCD("Volume", "Up")
        pandoraUtils.sendCommand('))))')

        pandoraUtils.parseAndWrite(2)
Esempio n. 3
0
    def button2(self):
        self.logger.info('Page 2 - Button 2 - DisLike')

        pandoraUtils.writeToLCD("Disliking", pandoraUtils.getShared("song"))
        pandoraUtils.sendCommand('-')

        pandoraUtils.parseAndWrite(2)
Esempio n. 4
0
    def button2(self):
        self.logger.info('Page 3 - Button 2 - Off')

        pandoraUtils.writeToLCD("Shutting Down", "Thanks")
        pandoraUtils.sendCommand('q')

        sleep(2)
        state.current_menu = menupower.MenuPower()
        state.current_menu.show_menu()
Esempio n. 5
0
    def button5(self):
        self.logger.info('Page 1 - Button 5 - Play/Pause')

        if state.playing_stream == "Playing":
            pandoraUtils.writeToLCD("Paused")
            state.playing_stream = "Paused"
        else:
            pandoraUtils.writeToLCD("Playing")
            state.playing_stream = "Playing"
            pandoraUtils.parseAndWrite(2)

        pandoraUtils.sendCommand('p')
Esempio n. 6
0
def main():

    pandoraUtils.initLogging()
    logger = logging.getLogger('eventReceiver')

    # Read event type from command arguments
    if len(sys.argv) < 2:
        logger.error("Error reading event type from command arguments")
        return

    event_type = sys.argv[1]
    logger.info("event_type="+event_type)

    # Read parameters from input
    params = {}
    
    for s in sys.stdin.readlines():
        param, value = s.split("=", 1)
        params[param.strip()] = value.strip()

    # Handle specific events
    if event_type == "songstart":

        info = {}
        info["song"] = params["title"]
        info["artist"] = params["artist"]
        info["album"] = params["album"]
        info["stationCount"] = params["stationCount"]
        info["stationName"] = params["stationName"]

        stations = []

        for i in range(0, int(params["stationCount"])):
            stations.append(params["station"+str(i)])

            if params["station"+str(i)] == params["stationName"]:
                info["stationNumber"] = i

        info["stations"] = stations

        pandoraUtils.setShared(info)
        pandoraUtils.parseAndWrite()

    elif event_type == "songfinish":
        pass

    elif event_type == "usergetstations":
        previous_station = pandoraUtils.getShared("stationNumber")
        if (previous_station != None):
            pandoraUtils.sendCommand('s'+str(previous_station))

    elif event_type == "userlogin":
        pandoraUtils.writeToLCD("Logging in...")
Esempio n. 7
0
    def button2(self):
        self.logger.info('Page 1 - Button 2 - Next Station')

        current_station = pandoraUtils.getShared("stationNumber")
        station_count = pandoraUtils.getShared("stationCount")
        next_station = current_station + 1
        if (next_station >= station_count):
            next_station = 0

        self.logger.info('next station: '+str(next_station))

        pandoraUtils.writeToLCD("Next", "Station")
        pandoraUtils.sendCommand('s'+str(next_station))

        # "listening to .."
        pandoraUtils.parseAndWrite(8, True)
        # display song
        pandoraUtils.parseAndWrite(3)
Esempio n. 8
0
    def button1(self):
        self.logger.info('Page 1 - Button 1 - Skip Song')

        pandoraUtils.writeToLCD("Skipping", "Song")
        pandoraUtils.sendCommand('n')