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()
with sock:
length_data = sock.recv(4)
print(length_data)
logger.debug(length_data)
length = int(length_data.decode())
print(length)
logger.debug(length)
pattern_data = sock.recv(length)
print(pattern_data)
logger.debug(pattern_data)
pattern.parse(pattern_data.decode())

View file

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

View file

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