Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
mensactrl
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
stratum0
mensactrl
Commits
1d44f290
Commit
1d44f290
authored
10 years ago
by
Emantor
Browse files
Options
Downloads
Patches
Plain Diff
Initial reddit commit
parent
cc0e2ff7
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
python/reddit.py
+53
-0
53 additions, 0 deletions
python/reddit.py
with
53 additions
and
0 deletions
python/reddit.py
0 → 100755
+
53
−
0
View file @
1d44f290
#!/usr/bin/env python2
# 10x48x5x7 Pixel
import
sys
,
client
,
praw
,
pygame
from
time
import
sleep
SERVER
=
"
tcp://localhost:5570
"
XOFF
=
0
YOFF
=
0
TEXT
=
"
Franz jagt im komplett verwahrlosten Taxi quer durch Bayern
"
pygame
.
init
()
def
clear
():
pixels
=
[
0
]
*
client
.
HEIGHT
*
client
.
WIDTH
client
.
blit
(
0
,
0
,
client
.
WIDTH
,
client
.
HEIGHT
,
pixels
)
def
render
(
TEXT
,
XOFF
=
0
,
YOFF
=
0
):
font
=
pygame
.
font
.
Font
(
"
/usr/share/fonts/misc/5x7.pcf.gz
"
,
7
)
text
=
font
.
render
(
TEXT
,
True
,
(
255
,
255
,
255
),
(
0
,
0
,
0
))
pxarray
=
pygame
.
PixelArray
(
text
)
pixels
=
[]
for
x
in
range
(
text
.
get_width
()):
for
y
in
range
(
text
.
get_height
()):
pixels
.
append
((
XOFF
+
x
,
YOFF
+
y
,
pxarray
[
x
][
y
]))
del
pxarray
client
.
set_pixels
(
pixels
)
r
=
praw
.
Reddit
(
user_agent
=
'
my_cool_application
'
)
reddit
=
[
"
opensource
"
,
"
linux
"
,
"
netsec
"
,
"
sysadmin
"
,
"
worldnews
"
,
"
hackerspaces
"
,
"
shittyaskscience
"
,
"
showerthoughts
"
,
"
all
"
]
while
True
:
for
i
in
reddit
:
clear
()
render
(
"
reddit.com/r/
"
+
i
,
0
,
0
)
YOFF
=
7
submissions
=
r
.
get_subreddit
(
i
).
get_hot
(
limit
=
10
)
subs
=
[
str
(
x
)
for
x
in
submissions
]
print
(
subs
)
for
i
in
range
(
1
,
10
):
votes
,
title
=
subs
[
i
].
split
(
'
::
'
,
1
)
TEXT
=
'
%s :: %s
'
%
(
votes
.
rjust
(
5
),
title
)
render
(
TEXT
,
0
,
YOFF
)
YOFF
+=
7
sleep
(
30
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment