Commit 60dc969f authored by Thomas Tsiakalakis's avatar Thomas Tsiakalakis

updated README and endpoints

parent 5be690d7
......@@ -5,4 +5,18 @@ pip3 install pillow
cp imageshow.service /etc/systemd/system/
systemctl daemon-reload
systemctl enable imageshow.service
```
\ No newline at end of file
```
# Usage
display image:
`curl -XPOST http://host/ -d @file.svg`
show last image:
`firefox http://host/`
turn display off:
`curl -XPOST http://host/off`
turn display on:
`curl -XPOST http://host/on`
......@@ -33,12 +33,12 @@ class Server(BaseHTTPRequestHandler):
if self.draw():
self.send_response(204)
self.end_headers()
elif self.path == '/blank':
blank()
elif self.path == '/off':
display_off()
self.send_response(204)
self.end_headers()
elif self.path == '/unblank':
unblank()
elif self.path == '/on':
display_on()
self.send_response(204)
self.end_headers()
else:
......@@ -107,15 +107,15 @@ def convert(image):
def draw(image):
print('drawing')
unblank()
display_on()
with open('/dev/' + FRAMEBUFFER, 'wb') as f:
f.write(image.tobytes())
def blank():
def display_off():
args = [BLANKINGCMD] + BLANKINGARGS_OFF
Popen(args, stdout=PIPE, stdin=PIPE, stderr=PIPE)
def unblank():
def display_on():
args = [BLANKINGCMD] + BLANKINGARGS_ON
Popen(args, stdout=PIPE, stdin=PIPE, stderr=PIPE)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment