aboutsummaryrefslogtreecommitdiff
path: root/host
diff options
context:
space:
mode:
authorjaseg <code@jaseg.net>2014-12-10 21:19:41 +0100
committerjaseg <code@jaseg.net>2014-12-10 21:19:41 +0100
commit3c329decfa20dd3f2bcd3beb1f512b4e3daf809e (patch)
tree68e461ef9f4573e28d5426ab4775f4ef2a3c8c11 /host
parente36a4054f18973980a9321e84fd79ea38793a6a4 (diff)
parent2387b0de02f6d51b848498443f9e8697c20bac5a (diff)
downloadmatelight-3c329decfa20dd3f2bcd3beb1f512b4e3daf809e.tar.gz
matelight-3c329decfa20dd3f2bcd3beb1f512b4e3daf809e.tar.bz2
matelight-3c329decfa20dd3f2bcd3beb1f512b4e3daf809e.zip
Merge branch 'master' of matelight:matelight
Conflicts: host/server.py
Diffstat (limited to 'host')
-rw-r--r--host/default.lines8
-rwxr-xr-xhost/server.py26
2 files changed, 25 insertions, 9 deletions
diff --git a/host/default.lines b/host/default.lines
index ecf0862..ca3afda 100644
--- a/host/default.lines
+++ b/host/default.lines
@@ -1,3 +1,4 @@
+\x1B[92mMate Light\x1B[93m@\x1B[92mPlay store or \x1B[94;101mtcp://ml.jaseg.net:1337\x1B[0;91m ♥
\x1B[38;5;214mabstraction is a type of decadence
\x1B[38;5;214mit's important to stay clean on all levels
\x1B[38;5;214mexpiring for love is beautiful but stupid
@@ -37,6 +38,7 @@
\x1B[38;5;214moccasionally principles are more valuable than people
\x1B[38;5;214ma sense of timing is the mark of genius
\x1B[38;5;214mexpressing anger is necessary
+\x1B[92mMate Light\x1B[93m@\x1B[92mPlay store or \x1B[94;101mtcp://ml.jaseg.net:1337\x1B[0;91m ♥
\x1B[38;5;214mroutine is a link with the past
\x1B[38;5;214mtorture is barbaric
\x1B[38;5;214melaboration is a form of pollution
@@ -66,6 +68,7 @@
\x1B[38;5;214mideals are replaced by conventional goals at a certain age
\x1B[38;5;214mmost people are not fit to rule themselves
\x1B[38;5;214mguilt and self-laceration are indulgences
+\x1B[92mMate Light\x1B[93m@\x1B[92mPlay store or \x1B[94;101mtcp://ml.jaseg.net:1337\x1B[0;91m ♥
\x1B[38;5;214mit's better to be lonely than to be with inferior people
\x1B[38;5;214mdying and coming back gives you considerable perspective
\x1B[38;5;214mabsolute submission can be a form of freedom
@@ -95,6 +98,7 @@
\x1B[38;5;214mchildren are the most cruel of all
\x1B[38;5;214mthe cruelest disappointment is when you let yourself down
\x1B[38;5;214mgo all out in romance and let the chips fall where they may
+\x1B[92mMate Light\x1B[93m@\x1B[92mPlay store or \x1B[94;101mtcp://ml.jaseg.net:1337\x1B[0;91m ♥
\x1B[38;5;214mthe only way to be pure is to stay by yourself
\x1B[38;5;214mspending too much time on self-improvement is antisocial
\x1B[38;5;214mknowing yourself lets you understand others
@@ -124,6 +128,7 @@
\x1B[38;5;214mat times inactivity is preferable to mindless functioning
\x1B[38;5;214mmostly you should mind your own business
\x1B[38;5;214mthe mundane is to be cherished
+\x1B[92mMate Light\x1B[93m@\x1B[92mPlay store or \x1B[94;101mtcp://ml.jaseg.net:1337\x1B[0;91m ♥
\x1B[38;5;214mselfishness is the most basic motivation
\x1B[38;5;214msloppy thinking gets worse over time
\x1B[38;5;214myou can't expect people to be something they're not
@@ -214,6 +219,7 @@
\x1B[38;5;214mpeople are boring unless they are extremists
\x1B[38;5;214mconfusing yourself is a way to stay honest
\x1B[38;5;214mstarvation is nature's way
+\x1B[92mMate Light\x1B[93m@\x1B[92mPlay store or \x1B[94;101mtcp://ml.jaseg.net:1337\x1B[0;91m ♥
\x1B[38;5;214mhumor is a release
\x1B[38;5;214mcrime against property is relatively unimportant
\x1B[38;5;214mat times your unconsciousness is truer than your conscious mind
@@ -244,6 +250,7 @@
\x1B[38;5;214mthe idea of transcendence is used to obscure oppression
\x1B[38;5;214mpolitics is used for personal gain
\x1B[38;5;214meating too much is criminal
+\x1B[92mMate Light\x1B[93m@\x1B[92mPlay store or \x1B[94;101mtcp://ml.jaseg.net:1337\x1B[0;91m ♥
\x1B[38;5;214mimposing order is man's vocation for chaos is hell
\x1B[38;5;214myou don't know what's what until you support yourself
\x1B[38;5;214mif you can't leave your mark give up
@@ -257,3 +264,4 @@
\x1B[38;5;214mfaithfulness is a social not a biological law
\x1B[38;5;214mrelativity is no boon to mankind
\x1B[38;5;214mmoderation kills the spirit
+\x1B[92mMate Light\x1B[93m@\x1B[92mPlay store or \x1B[94;101mtcp://ml.jaseg.net:1337\x1B[0;91m ♥
diff --git a/host/server.py b/host/server.py
index 025d534..c011c82 100755
--- a/host/server.py
+++ b/host/server.py
@@ -10,6 +10,7 @@ import itertools
import threading
import random
import os
+import sys
from ctypes import *
@@ -64,6 +65,7 @@ def printframe(fb):
def log(*args):
printlock.acquire()
print(strftime('\x1B[93m[%m-%d %H:%M:%S]\x1B[0m'), ' '.join(str(arg) for arg in args), '\x1B[0m')
+ sys.stdout.flush()
printlock.release()
class TextRenderer:
@@ -73,6 +75,7 @@ class TextRenderer:
def __iter__(self):
for i in range(-DISPLAY_WIDTH, self.width):
+ #print('Rendering text @ pos {}'.format(i))
yield render_text(self.text, i)
class MateLightUDPServer:
@@ -134,7 +137,7 @@ class MateLightTCPTextHandler(BaseRequestHandler):
data = str(self.request.recv(1024).strip(), 'UTF-8')
addr = self.client_address[0]
if len(data) > 140:
- self.request.sendall('TOO MUCH INFORMATION!\n')
+ self.request.sendall(b'TOO MUCH INFORMATION!\n')
return
log('\x1B[95mText from\x1B[0m {}: {}\x1B[0m'.format(addr, data))
renderqueue.append(TextRenderer(data))
@@ -150,11 +153,11 @@ userver = MateLightUDPServer()
userver.start()
defaultlines = [ TextRenderer(l[:-1].replace('\\x1B', '\x1B')) for l in open('default.lines').readlines() ]
-random.shuffle(defaultlines)
-defaulttexts = itertools.cycle(itertools.chain(*defaultlines))
+#random.shuffle(defaultlines)
+defaulttexts = itertools.chain(*defaultlines)
if __name__ == '__main__':
- #print('\033[?1049h'+'\n'*9)
+ print('\033[?1049h'+'\n'*9)
while True:
if renderqueue:
renderer = renderqueue.popleft()
@@ -167,13 +170,18 @@ if __name__ == '__main__':
frame = bytes([v for c in zip(list(foo), list(foo), list(foo)) for v in c ])
sleep(0.05)
else:
- frame = next(defaulttexts)
- sleep(0.05)
+ try:
+ frame = next(defaulttexts)
+ except StopIteration:
+ defaultlines = [ TextRenderer(l[:-1].replace('\\x1B', '\x1B')) for l in open('default.lines').readlines() ]
+ #random.shuffle(defaultlines)
+ defaulttexts = itertools.chain(*defaultlines)
sendframe(frame)
- #printframe(next(defaulttexts))
+# printframe(frame)
continue
+# sleep(0.1)
for frame in renderer:
sendframe(frame)
- sleep(0.05)
- #printframe(frame)
+# printframe(frame)
+# sleep(0.1)