Compare commits

...

4 commits

Author SHA1 Message Date
Your Name
1abdb0cbd2 add label_printer.service 2024-09-25 22:24:25 +02:00
Your Name
2418a7cff9 disable debug server 2024-09-25 22:24:13 +02:00
Your Name
2af7504c01 update label width 2024-09-25 22:23:32 +02:00
Your Name
63217f6b16 Make compiling on rpi possible 2024-09-25 22:20:55 +02:00
6 changed files with 30 additions and 10 deletions

View file

@ -1,5 +1,7 @@
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
export GO111MODULE=on
build: build:
cd epson/faxmachine &&\ cd epson/faxmachine &&\
go build -o ../library_bridge.so -buildmode=c-shared ../library_bridge.go go build -o ../library_bridge.so -buildmode=c-shared ../library_bridge.go

14
app.py
View file

@ -22,26 +22,26 @@ templates = {
"DNH": { "DNH": {
"text1": { "text1": {
"string": "Do Not Hack", "string": "Do Not Hack",
"size": 50, "size": 130,
"pos": 0 "pos": 0
}, },
"text2": { "text2": {
"string": "bottom text", "string": "bottom text",
"size": 25, "size": 50,
"pos": 55 "pos": 130
}, },
"cut": True "cut": True
}, },
"Food": { "Food": {
"text1": { "text1": {
"string": "Nickname", "string": "Nickname",
"size": 50, "size": 130,
"pos": 0 "pos": 0
}, },
"text2": { "text2": {
"string": "", "string": "",
"size": 25, "size": 50,
"pos": 55 "pos": 130
}, },
"cut": True "cut": True
} }
@ -206,5 +206,5 @@ def generated_file(filename):
if __name__ == "__main__": if __name__ == "__main__":
app.run(debug=True) app.run(debug=False)

17
label_printer.service Normal file
View file

@ -0,0 +1,17 @@
[Unit]
Description=Label printer webservice
ConditionPathExists=/home/pi/label_printer
After=network.target
[Service]
Type=simple
User=pi
Group=lp
WorkingDirectory=/home/pi/label_printer
ExecStart=sh -c "/bin/python3 app.py 2>&1 | tee /home/pi/log/labelprinter.log"
Restart=on-failure
RestartSec=10
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=labelapi
[Install]
WantedBy=multi-user.target

View file

@ -1,3 +1,4 @@
# SPDX-License-Identifier: GPL-3.0-or-later # SPDX-License-Identifier: GPL-3.0-or-later
label_width = 100
label_width = 213
printer_width = 512 printer_width = 512

View file

@ -10,7 +10,7 @@
{% if filename %} {% if filename %}
<br><br> <br><br>
<img src="user_data/{{filename}}" alt="Uploaded image"> <img src="user_data/{{filename}}" alt="Uploaded image" style="height: 150px; width: auto;">
<form method="POST" action="/image-print"> <form method="POST" action="/image-print">
{% if cut %} {% if cut %}

View file

@ -34,7 +34,7 @@
{% if filename %} {% if filename %}
<br><br> <br><br>
<img src="user_data/{{filename}}" alt="Generated Image"> <img src="user_data/{{filename}}" alt="Generated Image" style="height: 150px; width: auto;">
<form method="POST" action="/text-print"> <form method="POST" action="/text-print">
{% if cut %} {% if cut %}