diff --git a/src/main.py b/src/main.py index c3f409b..8658e4b 100644 --- a/src/main.py +++ b/src/main.py @@ -19,6 +19,7 @@ import os # For VARS from the shell. # Variables app = Flask(__name__) +ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg', 'gif'} # Load the configuration file try: @@ -44,13 +45,12 @@ try: os.mkdir(UPLOAD_FOLDER) app.logger.debug(f"Directory '{UPLOAD_FOLDER}' created successfully.") except FileExistsError: - app.logger.error(f"Directory '{UPLOAD_FOLDER}' already exists.") + app.logger.debug(f"Directory '{UPLOAD_FOLDER}' already exists.") except PermissionError: app.logger.error(f"Permission denied: Unable to create '{UPLOAD_FOLDER}'.") except Exception as e: app.logger.error(f"An error occurred: {e}") -ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg', 'gif'} # Output the config file if os.getenv('LIPY_DEBUG') == True: diff --git a/src/printer.py b/src/printer.py index e2e7095..77e4faa 100644 --- a/src/printer.py +++ b/src/printer.py @@ -125,6 +125,7 @@ class Printer(object): try: self.printer.open(self.usb_args); self.printer.set(align='left', font='a', bold=False, underline=0, width=1, height=1, density=8, invert=False, smooth=True, flip=False, double_width=False, double_height=False, custom_size=False) + self.printer.textln("> Printed by LittlePrinter | https://n07070.xyz/articles/littleprynter") self.printer.textln(clean_msg) self.printer.set(align='left', font='b', bold=False, underline=1, width=1, height=1, density=9, invert=False, smooth=True, flip=False, double_width=False, double_height=False, custom_size=False) self.printer.textln("> " + clean_signature + " @ " + strftime("%Y-%m-%d %H:%M:%S", gmtime())) @@ -161,6 +162,7 @@ class Printer(object): try: self.printer.open(self.usb_args) + self.printer.textln("> Printed by LittlePrinter | https://n07070.xyz/articles/littleprynter") self.printer.textln("> " + clean_signature + " @ " + strftime("%Y-%m-%d %H:%M:%S", gmtime())) self.printer.image(path) self.printer.cut() diff --git a/src/raspberry.py b/src/raspberry.py new file mode 100644 index 0000000..aaa7017 --- /dev/null +++ b/src/raspberry.py @@ -0,0 +1,4 @@ +from printer import Printer + +class Raspberry(object): + pass \ No newline at end of file diff --git a/src/static/js/webcam.js b/src/static/js/webcam.js index 6ba7e58..36f8e2b 100644 --- a/src/static/js/webcam.js +++ b/src/static/js/webcam.js @@ -124,7 +124,7 @@ function print_picture(data){ let time = currentDate.getHours() + ":" + currentDate.getMinutes() + ":" + currentDate.getSeconds(); formData.set("img", picture, "picture.png"); - formData.set("signature", "Printed via the webcam @ " + time) + formData.set("signature", " Accès Libre ~ 1 An ~ Fête de la Musique Libre @ " + time) fetch(url, { method: 'POST', // or 'PUT'