def google_do_search(request, searchTerm="Test"): row = SEARCH_BOX_ROW col = SEARCH_BOX_COL display = SEARCH_BOX_DISPLAY lines = [ "##################################################", "#%s#" % (searchTerm.ljust(48, ' '), ), "##################################################", "Google Search I'm feeling Lucky" #" " ] searchData = perform_search_raw(searchTerm) results = process_search_data(searchData) while len(results) < 10: results.append(" ".ljust(80, ' ')) sock = None try: for line in lines: board.write_split(sock, display, row, col, [line]) row += 1 #lines = perform_search(searchTerm) col = 0 for line in results: board.write_split(sock, display, row, col, [line]) row += 1 except: pass board.close_connection(sock) return HttpResponse(content=searchData, content_type="application/json")
def write_to_board(row, col, msg, **kwargs): try: sock = board.get_connection() board.write_split(sock, 0, row, col, [ msg ]) board.close_connection(sock) except: board.close_connection(sock) # print "Unexpected error:", sys.exc_info()[0] return False return True
def rawInterface(request, row, col, msg): row = int(row) col = int(col) try: sock = board.get_connection() board.write_split(sock, 0, row, col, [ msg ]) #board.write_to_board(sock, 0, row, col, msg) board.close_connection(sock) except: board.close_connection(sock) return HttpResponse(content="Wrote " + msg)
def board_test(request): sock = None # sock = board.get_connection() #board.write_to_board(sock, 0, 5, 15, "You have no chance to survive") #board.write_to_board(sock, 0, 6, 20, "Make your time") # board.write_to_board(sock, 0, 7, 20, "Boom zig") # board.write_to_board(sock, 0, 8, 30, "Boom zig") # board.write_to_board(sock, 0, 9, 40, "Boom zig") # board.write_to_board(sock, 0, 10, 50, "Boom zig") #board.write_split(sock, 0, 2, 30, [ "That's gotta be rough", ]) #board.write_split(sock, 0, 3, 40, [ chr(30) + "Sorry, technical difficulties", ]) #board.write_split(sock, 1, 0, 10, chr(30) + "Vertical Text!") #chr(30) + board.write_split(sock, 1, 0, 0, [ "Demerit Board: ", ]) demerits = [ ("@DonohuePatrickE", 6,), ("@IdeaFood", 1,), ("@donmball", 0,), (" ", ' ',), ] rowIdx = 1 for d in demerits: board.write_split(sock, 1, rowIdx, 0, [ " ", ]) board.write_split(sock, 1, rowIdx, 2, [ chr(31) + d[0], ]) # colorStr = '' # if d[1] > 1: # colorStr = chr(31) # if d[1] >= 3: # colorStr = chr(30) board.write_split(sock, 1, rowIdx, 25, [ chr(30) + str(d[1]) + " ", ]) rowIdx += 1 board.close_connection(sock) #updateTwitterBoard(1, 2) return HttpResponse(content="Okay")
def google_search_box(request): row = SEARCH_BOX_ROW col = SEARCH_BOX_COL display = SEARCH_BOX_DISPLAY lines = [ "##################################################", "# #", "##################################################", "Google Search I'm feeling Lucky", ] sock = None try: for line in lines: board.write_split(sock, display, row, col, [line]) row += 1 except: pass board.close_connection(sock) return HttpResponse(content="Drew search box")
def board_test(request): sock = board.get_connection() #board.write_to_board(sock, 0, 5, 15, "You have no chance to survive") #board.write_to_board(sock, 0, 6, 20, "Make your time") # board.write_to_board(sock, 0, 7, 20, "Boom zig") # board.write_to_board(sock, 0, 8, 30, "Boom zig") # board.write_to_board(sock, 0, 9, 40, "Boom zig") # board.write_to_board(sock, 0, 10, 50, "Boom zig") #board.write_split(sock, 0, 2, 30, [ "That's gotta be rough", ]) #board.write_split(sock, 0, 3, 40, [ chr(30) + "Sorry, technical difficulties", ]) #board.write_split(sock, 1, 0, 10, chr(30) + "Vertical Text!") #chr(30) + board.write_split(sock, 1, 0, 0, [ "Demerit Board: ", ]) demerits = [ ("@DonohuePatrickE", 6,), ("@IdeaFood", 1,), ("@donmball", 0,), (" ", ' ',), ] rowIdx = 1 for d in demerits: board.write_split(sock, 1, rowIdx, 0, [ " ", ]) board.write_split(sock, 1, rowIdx, 2, [ chr(31) + d[0], ]) # colorStr = '' # if d[1] > 1: # colorStr = chr(31) # if d[1] >= 3: # colorStr = chr(30) board.write_split(sock, 1, rowIdx, 25, [ chr(30) + str(d[1]) + " ", ]) rowIdx += 1 board.close_connection(sock) #updateTwitterBoard(1, 2) return HttpResponse(content="Okay")
def google_do_search(request, searchTerm="Test"): row = SEARCH_BOX_ROW col = SEARCH_BOX_COL display = SEARCH_BOX_DISPLAY lines = [ "##################################################", "#%s#" % (searchTerm.ljust(48, ' '),), "##################################################", "Google Search I'm feeling Lucky" #" " ] searchData = perform_search_raw(searchTerm) results = process_search_data(searchData) while len(results) < 10: results.append(" ".ljust(80, ' ')) sock = None try: for line in lines: board.write_split(sock, display, row, col, [ line ]) row += 1 #lines = perform_search(searchTerm) col = 0 for line in results: board.write_split(sock, display, row, col, [ line ]) row += 1 except: pass board.close_connection(sock) return HttpResponse(content=searchData, content_type="application/json")
def google_search_box(request): row = SEARCH_BOX_ROW col = SEARCH_BOX_COL display = SEARCH_BOX_DISPLAY lines = [ "##################################################", "# #", "##################################################", "Google Search I'm feeling Lucky", ] sock = None try: for line in lines: board.write_split(sock, display, row, col, [ line ]) row += 1 except: pass board.close_connection(sock) return HttpResponse(content="Drew search box")