def printline(nick, msg, me=False): l = len(nick) + 3 if me: nick = "* %s " % nick else: nick = "<%s> " % nick while msg: client.writeline("%s%s" % (nick, msg[:96-len(nick)])) nick = " " * len(nick) msg = msg[96-len(nick):].strip()
#!/usr/bin/env python2 # 10x48x5x7 Pixel import client, praw from time import sleep SERVER = "tcp://localhost:5570" XOFF = 0 YOFF = 0 TEXT = "" r = praw.Reddit(user_agent='Stratum0 Braunschweig Mensadisplay Parser') reddit = [ "opensource", "linux", "netsec", "sysadmin", "worldnews", "shittyaskscience", "showerthoughts", "explainlikeimcalvin", "pettyrevenge", "all" ] while True: for i in reddit: client.writeline("reddit.com/r/" + i) submissions = r.get_subreddit(i).get_hot(limit=9) subs = [unicode(x) for x in submissions] for i in range(0, 9): votes, title = subs[i].split(' :: ', 1) TEXT = '%s :: %s' % (votes.rjust(5), title) print(repr(TEXT)) client.writeline(TEXT) sleep(10)
from time import sleep SERVER = "tcp://localhost:5570" XOFF = 0 YOFF = 0 TEXT = "" r = praw.Reddit(user_agent='Stratum0 Braunschweig Mensadisplay Parser') reddit = ["opensource" ,"linux" ,"netsec" ,"sysadmin" ,"worldnews" ,"shittyaskscience" ,"showerthoughts" ,"explainlikeimcalvin" ,"pettyrevenge" ,"all"] while True: for i in reddit: client.writeline("reddit.com/r/" + i) submissions = r.get_subreddit(i).get_hot(limit=9) subs = [unicode(x) for x in submissions] for i in range(0,9): votes,title = subs[i].split(' :: ',1) TEXT = '%s :: %s' % (votes.rjust(5),title) print(repr(TEXT)) client.writeline(TEXT) sleep(10)
#!/usr/bin/env python import sys import client # read lines from stdin and write them to the display. line = sys.stdin.readline().decode("utf8") while(line != ""): client.writeline(line) line = sys.stdin.readline().decode("utf8")
#!/usr/bin/env python2 import sys import client # read lines from stdin and write them to the display. line = sys.stdin.readline().decode("utf8") while(line != ""): client.writeline(line) line = sys.stdin.readline().decode("utf8")