示例#1
0
    def setup(self):

        self.blossom = Blossom(self)
        self.lilypads = []

        for i in range(settings.LILYPADS):
            self.lilypads.append(LilyPad(self, i))

        self.blossom_providers = []
        self.lilypad_providers = []

        try:
            from ws2801 import WS2801

            self.strips = WS2801()
            self.addBlossomProvider(self.strips)

        except:
            log.msg("Could not initialize WS2801 strips over SPI!")

        self.wireless = None
        self.serial_port = None

        self.wireless = SerialWireless(self)
        self.serial_port = SerialPort(self.wireless, settings.SERIAL_PORT, reactor, settings.SERIAL_BAUD)
        self.addLilypadProvider(self.wireless)

        self.boot_mode = BootMode(self)
        self.geyser_mode = GeyserMode(self)

        self.current_mode = self.geyser_mode

        self.mode = self.boot_mode
        self.mode.startMode()

        self.loop_index = 0
        self.loop = task.LoopingCall(self.update)
        self.loop.start(1.0/settings.FRAME_RATE)
示例#2
0
import time
import sys
from blossom import Blossom

CONFIG = {
    'id': '',  # Blossom ID
    'pw': '',  # Blossom PW
}

blossom = Blossom()
blossom.login(CONFIG['id'], CONFIG['pw'])

reserve_option = {
    'people':
    '8',  # 이용인원
    'date':
    '2018032420180325',  # 이용기간 (YYYYMMDDYYYYMMDD, 시작일(토)종료일(일))
    'lounge': [
        'O', 'P', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L',
        'M', 'N'
    ],  # 예약라운지 선호도 순
}

refresh = False

while True:
    if len(reserve_option['lounge']) == 0:
        print('이번주는 공쳤어요. 다음주에.')
        sys.exit()

    print('라운지 {} 시도'.format(reserve_option['lounge'][0]))
示例#3
0
class CryptoLotus(service.Service):

    def setup(self):

        self.blossom = Blossom(self)
        self.lilypads = []

        for i in range(settings.LILYPADS):
            self.lilypads.append(LilyPad(self, i))

        self.blossom_providers = []
        self.lilypad_providers = []

        try:
            from ws2801 import WS2801

            self.strips = WS2801()
            self.addBlossomProvider(self.strips)

        except:
            log.msg("Could not initialize WS2801 strips over SPI!")

        self.wireless = None
        self.serial_port = None

        self.wireless = SerialWireless(self)
        self.serial_port = SerialPort(self.wireless, settings.SERIAL_PORT, reactor, settings.SERIAL_BAUD)
        self.addLilypadProvider(self.wireless)

        self.boot_mode = BootMode(self)
        self.geyser_mode = GeyserMode(self)

        self.current_mode = self.geyser_mode

        self.mode = self.boot_mode
        self.mode.startMode()

        self.loop_index = 0
        self.loop = task.LoopingCall(self.update)
        self.loop.start(1.0/settings.FRAME_RATE)

    def addSimulator(self, simulator):
        pass

    def addLilypadProvider(self, provider):
        self.lilypad_providers.append(provider)

    def addBlossomProvider(self, provider):
        self.blossom_providers.append(provider)

    def updateBlossom(self, blossom):
        for provider in self.blossom_providers:
            provider.updateBlossom(blossom)

    def updateLilypad(self, lilypad):
        for provider in self.lilypad_providers:
            provider.updateLilypad(lilypad)

    def resetLilypads(self):
        for provider in self.lilypad_providers:
            provider.resetLilypads()

    def changeMode(self, mode):
        self.mode = mode
        self.mode.startMode()

    def update(self):
        self.mode.update()
        self.blossom.update()

    def getSimulatorFactory(self):
        f = SimulatorFactory(self, 'ws://0.0.0.0:%d' % (settings.SIMULATOR_PORT,))
        return f

    def stopService(self):
        service.Service.stopService(self)
        self.mode.stopMode()
        self.blossom.clear()
        self.loop.stop()