diff --git a/app.py b/app.py index b864937..cbe2740 100644 --- a/app.py +++ b/app.py @@ -4,7 +4,7 @@ import threading import queue import pdf2image from brother_ql.conversion import convert -from brother_ql.backends.helpers import send +from brother_ql.backends.helpers import send, status from brother_ql.raster import BrotherQLRaster from PIL import Image import mimetypes @@ -17,7 +17,7 @@ app = Flask(__name__) # Set up logging log_file = 'log.txt' log_handler = RotatingFileHandler(log_file, maxBytes=10*1024*1024, backupCount=5) # 10MB per log file, keep 5 backups -log_handler.setLevel(logging.INFO) +log_handler.setLevel(logging.DEBUG) log_formatter = logging.Formatter('%(asctime)s - %(levelname)s - %(message)s') log_handler.setFormatter(log_formatter) app.logger.addHandler(log_handler) @@ -106,6 +106,14 @@ def process_queue(): # Process the file (convert and print) app.logger.info(f"Processing file: {file_path}") print_address_label(file_path) + wait = 15 + while wait > 0: + # get printer status + printer_status = status(printer_model, printer_identifier=printer, backend_identifier=backend) + app.logger.info(f"Printer status: {printer_status}") + print(printer_status) + time.sleep(1) + wait -= 1 # Signal that the task is done file_queue.task_done()