Exemplo n.º 1
0
def startup(args):
    global glo_seeburg

    bus = smbus.SMBus(1)

    if args.vfd:
        from vfdcontrol import VFDController
        display = VFDController(MCP23017(bus, 0x20), enablePoller=False)
        display.setDisplay(True, False, False)
        display.cls()
        display.writeStr("Ready!")
        display.set_color(0)
    else:
        display = None

    if os.path.exists("titles/song_table.py"):
        from titles.song_table import song_table
    else:
        song_table = {}

    seeburg = SeeburgThread(bus,
                            0x21,
                            vfd=display,
                            stereo_url=args.stereo_url,
                            song_table=song_table)
    seeburg.start()

    glo_seeburg = seeburg
Exemplo n.º 2
0
def main():
    import smbus
    from datetime import datetime

    bus = smbus.SMBus(1)
    display = VFDController(MCP23017(bus, 0x20), four_line=False)

    #GPIO.setmode(GPIO.BCM)
    #display.enable_interrupts(26)

    display.setDisplay(True, False, False)
    display.cls()

    while True:
        (dates, times) = str(datetime.now()).split(" ")
        display.setPosition(0, 0)
        display.writeStr(trimpad(dates, 16))
        display.setPosition(0, 1)
        display.writeStr(trimpad(times, 16))

        if display.poller.get_button1_event():
            print("button1")

        if display.poller.get_button2_event():
            print("button2")

        if display.poller.get_button3_event():
            print("button3")

        delta = display.poller.get_delta()
        if delta != 0:
            print(delta)

        time.sleep(0.01)
Exemplo n.º 3
0
def main():
    import smbus
    from datetime import datetime

    bus = smbus.SMBus(1)
    display = VFDController(MCP23017(bus, 0x20))

    display.setDisplay(True, False, False)
    display.cls()

    while True:
        (dates, times) = str(datetime.now()).split(" ")
        display.setPosition(0, 0)
        display.writeStr(trimpad(dates, 16))
        display.setPosition(0, 1)
        display.writeStr(trimpad(times, 16))

        if display.poller.get_button1_event():
            print "button1"

        if display.poller.get_button2_event():
            print "button2"

        if display.poller.get_button3_event():
            print "button3"

        delta = display.poller.get_delta()
        if delta != 0:
            print delta

        time.sleep(0.01)
Exemplo n.º 4
0
def main():
    (options, args) = parse_options()

    bus = smbus.SMBus(1)
    display = VFDController(MCP23017(bus, 0x20))

    display.setDisplay(True, False, False)
    display.cls()
    display.set_color(COLOR_NONE)

    player = VFDMidiPlayer(root=options.dir, display=display)

    print "Loaded ", player.count, "files into database"

    if (options.writecatalog):
        player.write_catalog()
        print "catalog saved"
        return

    try:
        while True:
            player.poll()
            time.sleep(0.1)

    finally:
        player.shutdown()
        termios.tcsetattr(stdin_fd, termios.TCSAFLUSH, old_term)
Exemplo n.º 5
0
def main():
    bus = smbus.SMBus(1)
    display = VFDController(MCP23017(bus, 0x20))

    display.setDisplay(True, False, False)
    display.cls()
    display.set_color(COLOR_NONE)

    display.writeStr(sys.argv[1])
Exemplo n.º 6
0
def main():
    args = parse_args()

    bus = smbus.SMBus(1)

    if args.vfd:
        from vfdcontrol import VFDController
        display = VFDController(MCP23017(bus, 0x20), enablePoller=False)
        display.setDisplay(True, False, False)
        display.cls()
        display.writeStr("Ready!")
        display.set_color(0)
    else:
        display = None

    if os.path.exists("titles/song_table.py"):
        from titles.song_table import song_table
    else:
        song_table = {}

    seeburg = SeeburgThread(bus,
                            0x21,
                            vfd=display,
                            stereo_url=args.stereo_url,
                            song_table=song_table)
    seeburg.start()

    if args.interactive:
        print "q - quarter"
        print "d - dime"
        print "n - nickel"
        print "r - simulate a result"
        print "x - exit"

        print ""

        stdin_fd = sys.stdin.fileno()
        new_term = termios.tcgetattr(stdin_fd)
        old_term = termios.tcgetattr(stdin_fd)
        new_term[3] = (new_term[3] & ~termios.ICANON & ~termios.ECHO)
        termios.tcsetattr(stdin_fd, termios.TCSAFLUSH, new_term)

        try:
            while True:
                dr, dw, de = select.select([sys.stdin], [], [], 0.1)
                if dr != []:
                    ch = sys.stdin.read(1)

                    if (ch == "q"):
                        seeburg.insert_quarter()
                    elif (ch == "d"):
                        seeburg.insert_dime()
                    elif (ch == "n"):
                        seeburg.insert_nickel()
                    elif (ch == "r"):
                        selection = raw_input("Code (letter+digit):")
                        try:
                            print
                            seeburg.handle_result(
                                seeburg.letter_to_number(selection[0]),
                                int(selection[1:]))
                        except:
                            traceback.print_exc()
                    elif (ch == "x"):
                        break
        finally:
            termios.tcsetattr(stdin_fd, termios.TCSAFLUSH, old_term)

    else:
        while True:
            time.sleep(1)