コード例 #1
0
def main():
	parser = argparse.ArgumentParser()
	parser.add_argument('-d', '--device', type = str, default = "/dev/ttyUSB0", help = "The serial device to use for IBIS communication")
	parser.add_argument('-f', '--file', type = str, help = "The filename of a text file to load entries from.")
	parser.add_argument('-s', '--server', type = str, help = "The host for server communication")
	parser.add_argument('-p', '--port', type = int, default = 1337, help = "The port for server communication")
	args = parser.parse_args()
	
	with open(args.file, 'r') as f:
		lines = [entry.rstrip("\n") for entry in f.readlines()]
	
	if args.server:
		wrapper = ibis.EthernetWrapper(args.server, args.port)
	else:
		master = ibis.IBISMaster(args.device)
	
	current_line = 0
	
	for line in lines:
		raw_input("Next line: %s" % line)
		if args.server:
			wrapper.send_message(line)
		else:
			master.send_next_stop__003c(line)
	
	print "End of lyrics file. Exiting."
コード例 #2
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('-d',
                        '--device',
                        type=str,
                        default="/dev/ttyUSB0",
                        help="The serial device to use for IBIS communication")
    parser.add_argument(
        '-i',
        '--interval',
        type=float,
        default=3.0,
        help="The interval between artist and title display (in seconds)")
    parser.add_argument(
        '-f',
        '--file',
        type=str,
        help=
        "The filename of a text file to load entries from. Format: Multiple lines, Artist | Title"
    )
    parser.add_argument('-s',
                        '--server',
                        type=str,
                        help="The host for server communication")
    parser.add_argument('-p',
                        '--port',
                        type=int,
                        default=1337,
                        help="The port for server communication")
    args = parser.parse_args()

    if args.file:
        with open(args.file, 'r') as f:
            entries = [[
                item.strip() for item in entry.rstrip("\n").split("|")
            ] for entry in f.readlines()]
    else:
        entries = None

    if args.server:
        wrapper = ibis.EthernetWrapper(args.server, args.port)
        mgr = DisplayManager(wrapper=wrapper, entries=entries)
    else:
        master = ibis.IBISMaster(args.device)
        mgr = DisplayManager(master=master, entries=entries)

    mgr.INTERVAL = args.interval

    thread.start_new_thread(mgr.process_buffer, ())
    try:
        mgr.input_loop()
    except KeyboardInterrupt:
        pass
コード例 #3
0
    def __init__(self,
                 serial_port,
                 port=4242,
                 timeout=120,
                 gpio_pinmap={},
                 verbose=False,
                 debug=False,
                 selftest=False):
        self.master = ibis.IBISMaster(serial_port, gpio_pinmap=gpio_pinmap)
        self.controller = Controller(self.master)
        self.controller.TIMEOUT = timeout
        self.controller.VERBOSE = verbose
        self.controller.DEBUG = debug

        if selftest:
            self.controller.selftest()

        self.listener = Listener(self.controller, port=port)
コード例 #4
0
from twitterscraper import query_tweets
import datetime as dt
import ibis
import time
m = ibis.IBISMaster("/dev/ttyUSB0", debug=True)

var = 1
while var == 1:

    for tweet in query_tweets("#35c3",
                              1,
                              begindate=dt.date.today(),
                              enddate=dt.date.today() +
                              dt.timedelta(days=1))[:5]:
        for x in range(0, len(tweet.text) - 1):
            #print(tweet.text.upper()[x:x + 24])
            m.DS009(tweet.text.upper()[x:x + 24])
            time.sleep(0.4)