1
0
Fork 0

Compare commits

..

2 Commits
main ... main

Author SHA1 Message Date
Foxo 91afaf0e39 Merge pull request 'Add 37C3 to README' (#7) from eloy/printer_bot:main into main
Reviewed-on: foxo/printer_bot#7
2024-03-20 21:26:37 +00:00
Eloy a6c4de8e2c Add 37C3 to README 2024-01-21 17:52:40 +01:00
4 changed files with 9 additions and 35 deletions

View File

@ -11,14 +11,12 @@ Currently, you can set any command to print your sticker (by default brother_ql
* [BornHack (2023)](https://bornhack.dk/bornhack-2023)
* [Chaos Communication Camp (2023)](https://events.ccc.de/camp/2023/infos/index.html)
* [37th Chaos Communication Congress (2023)](https://events.ccc.de/congress/2023/infos/startpage.html)
* [BornHack (2024)](https://bornhack.dk/bornhack-2024) [Now in Color!]
**Running it at your con? Add it with a pull request! :D**
## Tested printers
* Brother QL-700 / QL-800 / QL-500 (brother_ql)
* Brother VC-500w [Using this repo to send files to the printer and do the neccesary conversion to the correct format](https://gitlab.com/lenchan139/labelprinter-vc500w) see README_vc500w_support.md for more info
## Recommended label rolls
@ -29,7 +27,7 @@ There are a variety of label rolls you can buy:
* DK-44605: paper, black on yellow
* DK-22606: plastic film, black on yellow
* DK-22113: plastic film, black on transparent
* CZ-1005: plasic/laminated ZINK labels
Be careful of models that don't feature glue! Make sure whatever you buy is a label and not just a roll :)
## Requirements
@ -38,6 +36,7 @@ Be careful of models that don't feature glue! Make sure whatever you buy is a la
* telethon
* PIL (Python Imaging Library) library (Pillow)
* brother_ql
You can install the requirements by running this command:
`python3 -m pip install -r requirements.txt`

View File

@ -1,26 +0,0 @@
# Printer Bot VC-500W support
This project aims to provide functionality for using the Brother VC-500W printer. Follow the setup instructions below to get started.
## Brother VC-500W Setup Instructions
To use the Brother VC-500W with this project, follow the steps below:
1. **Navigate to the `printer_bot` Folder**:
cd /path/to/your/printer_bot
2. **Download the required files** \
`git clone https://gitlab.com/lenchan139/labelprinter-vc500w.git labelprinter-vc500w` \
`mv labelprinter-vc500w/* .` \
`rm -rf labelprinter-vc500w`
3. **Check if all files are in the folder**
4. **Edit your config file to the correct settings**
5. **profit** \
For the correct command to send to the printer and how it all works please see the gitlab repo.

2
bot.py
View File

@ -88,7 +88,7 @@ async def handler(ev):
# Resize the image
img.thumbnail([WIDTH_PX, HEIGHT_PX], resample=Image.LANCZOS, reducing_gap=None)
# Convert to grayscale and apply a gamma of 1.8 comment these out when using a VC-500W
# Convert to grayscale and apply a gamma of 1.8
img = img.convert('L')
if GAMMA_CORRECTION != 1:

View File

@ -1,3 +1,4 @@
# To get an API_ID and API_HASH, you need to sign up to be a Telegram Dev.
# Do it here: https://core.telegram.org/api/obtaining_api_id
API_ID = 11111
@ -17,7 +18,7 @@ UNLOCKED_MSG = 'Printer has been unlocked. Have fun!'
# Limits to prevent abuse
PASSWORD = '12345' # Set to None if no password required
BASE_COOLDOWN = 10 # Seconds between stickers printing set to 45 if using VC-500W
BASE_COOLDOWN = 10 # Seconds between stickers printing
MAX_ASPECT_RATIO = 1.5 # Maximum ratio between height/width of sticker
ADMIN_ID = 111111 # Find your own id with the /id command
@ -26,11 +27,11 @@ IMAGE_PATH = '/tmp/image.png'
CACHE_DIR = '/tmp/printercache'
# Remember to add your user to the "lp" group or this won't work!
PRINT_COMMAND = f"brother_ql -m QL-700 -b linux_kernel -p file:///dev/usb/lp0 print -l 62 {IMAGE_PATH} -d" #Comment this out when using a VC-500W and see vc500.md
#PRINT_COMMAND = f"sh labelprinter.sh --host 192.168.5.5 --print-mode vivid --print-cut full --print-jpeg '{IMAGE_PATH}' #change IP to your printer's IP and uncomment
PRINT_COMMAND = f"brother_ql -m QL-700 -b linux_kernel -p file:///dev/usb/lp0 print -l 62 {IMAGE_PATH} -d"
PRINT_SUCCESS_COMMAND = None # "mpv --no-video success.wav" - this was used to play audio
# Resize and process settings
WIDTH_PX = 696
HEIGHT_PX = 9999 # This means "do not care about height"
GAMMA_CORRECTION = 1.8 #This isn't used when using a VC-500W
GAMMA_CORRECTION = 1.8
BACKGROUND_COLOR = 'white'