This commit is contained in:
jane 2020-11-09 01:38:02 -05:00
parent 18528c8cf8
commit 47c1863690
3 changed files with 11 additions and 6 deletions

View file

@ -65,11 +65,11 @@ def socket_loop():
sock, addr = s.accept() sock, addr = s.accept()
with sock: with sock:
length_data = sock.recv(4) length_data = sock.recv(4)
print(length_data) logger.debug(length_data)
length = int(length_data.decode()) length = int(length_data.decode())
print(length) logger.debug(length)
pattern_data = sock.recv(length) pattern_data = sock.recv(length)
print(pattern_data) logger.debug(pattern_data)
pattern.parse(pattern_data.decode()) pattern.parse(pattern_data.decode())

View file

@ -1,4 +1,4 @@
debug_statements = False debug_statements = True
def debug(msg): def debug(msg):

View file

@ -1,6 +1,7 @@
import sys import sys
import json import json
import random import random
import logger
this = sys.modules[__name__] this = sys.modules[__name__]
@ -62,6 +63,10 @@ def apply(targets, args, func):
else: else:
this.values[targets[target]['channel']] = _apply( this.values[targets[target]['channel']] = _apply(
this.values[targets[target]['channel']], 0, func) this.values[targets[target]['channel']], 0, func)
logger.debug("{} : {}".format(
targets[target]['channel'],
this.values[targets[target]['channel']]
))
this.instructions = { this.instructions = {
@ -117,5 +122,5 @@ def pat(index, tick, previous_values):
def parse(str): def parse(str):
this.encoded = str this.encoded = str
print(this.encoded) logger.debug(this.encoded)
this.pattern = json.loads(this.encoded) this.pattern = json.loads(this.encoded)