Skip to content

b4ckspace/phomemer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

356c676 · Jan 10, 2025

History

60 Commits
Apr 14, 2024
Mar 30, 2024
Jan 10, 2025
Jan 10, 2025
Apr 18, 2024
Apr 19, 2024
Apr 19, 2024
Mar 30, 2024
Sep 5, 2024
Apr 18, 2024
Apr 14, 2024
Apr 7, 2024
Apr 14, 2024
Apr 7, 2024

Repository files navigation

phomemer

Docker container

Note: it's important to run with --net=host. This allows the container to access bluetooth devices. Sadly, this will most likely only work under linux.

docker run -e PHOMEMO_BT_MAC=<your-printers-mac> --net=host -it ghcr.io/b4ckspace/phomemer

USB connection

Instead of Bluetooth, you can also connect to your printer via USB.
This should create a character device at /dev/usb/lp0 (or a higher number). You can pass this character device into the Docker container and omit the PHOMEMO_BT_MAC setting to make phomemer use the USB connection. (PHOMEMO_BT_MAC takes precedence over USB if it is specified!).

This requires that the Docker user has sufficient permission to write to /dev/usb/lp0 — assign the correct group membership or modify the character device's permissions through a udev rule if not.

--net=host is still required here to allow you/your users to access phomemer through a well-known port on the Docker host's localhost.

docker run --device '/dev/usb/lp0:/dev/phomemo' --net=host -it ghcr.io/b4ckspace/phomemer

Docker compose

  1. Copy .env.dist to .env and enter your printer address, with colons

(Without colons it will fail, ERROR 500)

docker compose up

Local Development

PHOMEMO_BT_MAC=<your-printers-mac> poetry run flask \
  --app phomeme:app run \
  --debug --host 0.0.0.0 --port 8000

Production

PHOMEMO_BT_MAC=<your-printers-mac> poetry run gunicorn -w 1 'phomeme:app' -b [::0]

Usage

Visit the awesome frontend on http://localhost:8000 or send via curl using curl -v -F [email protected] localhost:5000/print.

Credits

The print code is inspired by labelprinter from SFZ-aalen