product bag label

main
alex 2024-06-08 22:45:44 +02:00
parent 5e69bfa09e
commit 73816eaca5
12 changed files with 432 additions and 143 deletions

View File

@ -36,41 +36,41 @@
"type": "select", "type": "select",
"displayName": "Produkttyp auswählen", "displayName": "Produkttyp auswählen",
"options": [ "options": [
"#32420 Gizmo die Eidechse, Farbe, Grün/Blau/Orange, (Glänzend)", "#32420 Gizmo die Eidechse, FARBE, Grün/Blau/Orange, (Glänzend)",
"#83650 Gizmo die Eidechse, Farbe, Gold, (Glänzend)", "#83650 Gizmo die Eidechse, FARBE, Gold, (Glänzend)",
"#92784 Gizmo die Eidechse, Farbe, Glitzer Grün, (Seidenmatt)", "#92784 Gizmo die Eidechse, FARBE, Glitzer Grün, (Seidenmatt)",
"#36521 Charlie das Häschen, Farbe, Hellbraun, (Matt)", "#36521 Charlie das Häschen, FARBE, Hellbraun, (Matt)",
"#48273 Charlie das Häschen, Farbe, Gold, (Glänzend)", "#48273 Charlie das Häschen, FARBE, Gold, (Glänzend)",
"#71936 Ruby die Schlange, Farbe, Feuerrot, (Glänzend)", "#71936 Ruby die Schlange, FARBE, Feuerrot, (Glänzend)",
"#58324 Ruby die Schlange, Farbe, Rot/Blau, (Glänzend)", "#58324 Ruby die Schlange, FARBE, Rot/Blau, (Glänzend)",
"#78648 Ruby die Schlange, Farbe, Gold, (Glänzend)", "#78648 Ruby die Schlange, FARBE, Gold, (Glänzend)",
"#21433 Bruno der Dino, Farbe, Grün/Blau/Orange, (Glänzend)", "#21433 Bruno der Dino, FARBE, Grün/Blau/Orange, (Glänzend)",
"#57953 Bruno der Dino, Farbe, Rot/Blau, (Glänzend)", "#57953 Bruno der Dino, FARBE, Rot/Blau, (Glänzend)",
"#90578 Bruno der Dino, Farbe, Gold, (Glänzend)", "#90578 Bruno der Dino, FARBE, Gold, (Glänzend)",
"#51563 Bruno der Dino, Farbe, Himmelblau, (Fluoreszierend)", "#51563 Bruno der Dino, FARBE, Himmelblau, (Fluoreszierend)",
"#23564 Flamara der Drache, Farbe, Feuerrot, (Glänzend)", "#23564 Flamara der Drache, FARBE, Feuerrot, (Glänzend)",
"#51139 Flamara der Drache, Farbe, Himmelblau, (Fluoreszierend)", "#51139 Flamara der Drache, FARBE, Himmelblau, (Fluoreszierend)",
"#77970 Flamara der Drache, Farbe, Gold, (Glänzend)", "#77970 Flamara der Drache, FARBE, Gold, (Glänzend)",
"#43356 Flamara der Drache, Farbe, Schwarz, ", "#43356 Flamara der Drache, FARBE, Schwarz, ",
"#32974 Finn der Sad Hamster, Stil, Standard, Weiblich", "#32974 Finn der Sad Hamster, STIL, Standard, Weiblich",
"#60798 Finn der Sad Hamster, Stil, Schlüsselanhänger, Weiblich", "#60798 Finn der Sad Hamster, STIL, Schlüsselanhänger, Weiblich",
"#30563 Finn der Sad Hamster, Stil, Groß, Weiblich", "#30563 Finn der Sad Hamster, STIL, Groß, Weiblich",
"#90586 Finn der Sad Hamster, Stil, Standard, Männlich", "#90586 Finn der Sad Hamster, STIL, Standard, Männlich",
"#99560 Finn der Sad Hamster, Stil, Schlüsselanhänger, Männlich", "#99560 Finn der Sad Hamster, STIL, Schlüsselanhänger, Männlich",
"#47364 Finn der Sad Hamster, Stil, Groß, Männlich", "#47364 Finn der Sad Hamster, STIL, Groß, Männlich",
"#93047 Mia das Kätzchen, Farbe, Grau, ", "#93047 Mia das Kätzchen, FARBE, Grau, ",
"#86423 Mia das Kätzchen, Farbe, Weiß, ", "#86423 Mia das Kätzchen, FARBE, Weiß, ",
"#X38764 Mia das Kätzchen, Farbe, Weiß, (Schlüsselanhänger)", "#X38764 Mia das Kätzchen, FARBE, Weiß, (Schlüsselanhänger)",
"#56083 Hoppel das Häschen, Farbe, Grau, ", "#56083 Hoppel das Häschen, FARBE, Grau, ",
"#78693 Elias der Corgi, Farbe, Braun/Weiß, ", "#78693 Elias der Corgi, FARBE, Braun/Weiß, ",
"#37335 Axel der Axolotl, Farbe, Pink, ", "#37335 Axel der Axolotl, FARBE, Pink, ",
"#26822 Dilo der Delfin, Farbe, Blau ➔ Weiß, ", "#26822 Dilo der Delfin, FARBE, Blau ➔ Weiß, ",
"#51665 Sunny das Einhorn, Farbe, Weiß, ", "#51665 Sunny das Einhorn, FARBE, Weiß, ",
"#35717 Stella der Phönix, Farbe, Sonderanfertigung, Rosa/Weiß", "#35717 Stella der Phönix, FARBE, Sonderanfertigung, Rosa/Weiß",
"#26843 Stella der Phönix, Farbe, Verlauf Lila/Pink, ", "#26843 Stella der Phönix, FARBE, Verlauf Lila/Pink, ",
"#74943 Brain der Fuchs, Stil, Standard, ", "#74943 Brain der Fuchs, STIL, Standard, ",
"#78071 Weißer Hund, Stil, Weiß, ", "#78071 Weißer Hund, STIL, Weiß, ",
"#92734 Amigo der Capybara, Farbe, Braun, " "#92734 Amigo der Capybara, FARBE, Braun, "
] ]
} }
] ]

View File

@ -105,7 +105,7 @@ def google_sheets_products():
products.append({ products.append({
"id": row[rowIndexProductId], "id": row[rowIndexProductId],
"name": add_underscore_at_position(row[1], int(row[rowIndexNameSplitAtPosition])), "name": add_underscore_at_position(row[1], int(row[rowIndexNameSplitAtPosition])),
"product_variant": row[rowIndexProductVariant], "product_variant": row[rowIndexProductVariant].upper(),
"product_characteristic_line_1": row[rowIndexProductCharacteristicLine1], "product_characteristic_line_1": row[rowIndexProductCharacteristicLine1],
"product_characteristic_line_2": row[rowIndexProductCharacteristicLine2], "product_characteristic_line_2": row[rowIndexProductCharacteristicLine2],
}) })
@ -116,10 +116,10 @@ def google_sheets_products():
with open('../../groupsData/google-sheet-products.json', 'w', encoding='utf-8') as json_file: with open('../../groupsData/google-sheet-products.json', 'w', encoding='utf-8') as json_file:
json.dump(products_dict, json_file, ensure_ascii=False, indent=2) json.dump(products_dict, json_file, ensure_ascii=False, indent=2)
update_grouptask_products_list_options( for file_path in ["../../groups/shx-product-label/index.json",
"../../groups/shx-product-label/index.json", products) "../../groups/shx-all-in-one-order/index.json",
update_grouptask_products_list_options( "../../groups/shx-intern-product-bag-label/index.json"]:
"../../groups/shx-all-in-one-order/index.json", products) update_grouptask_products_list_options(file_path, products)
print("Finished. Do not forget to reload the group configuration by clicking on the 'Reload' button above the table on the right side.") print("Finished. Do not forget to reload the group configuration by clicking on the 'Reload' button above the table on the right side.")

View File

@ -0,0 +1,133 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Intern Product Bag Label</title>
<style>
:root {
--container-width: 1020px;
--container-height: 1020px;
}
@font-face {
font-family: "Outfit";
src: url("../../groupsData/static/Outfit-VariableFont_wght.ttf");
}
body,
html {
margin: 0;
padding: 0;
font-size: 14px;
width: var(--container-width);
height: var(--container-height);
overflow: hidden;
font-family: "Outfit";
}
.container {
width: var(--container-width);
height: var(--container-height);
}
.inner-container {
height: 100%;
display: flex;
flex-direction: column;
justify-content: space-between;
height: 100%;
}
h3 {
padding: 0;
margin: 0;
}
</style>
</head>
<body>
<div class="container">
<div class="inner-container">
<div style="padding-left: 20px; padding-right: 20px">
<div
style="
display: flex;
justify-content: space-between;
align-items: center;
"
>
<h1
style="
font-size: 128px;
margin: 0;
font-weight: 400;
letter-spacing: 20px;
"
>
{{PRODUCT_ID}}
</h1>
<img
style="width: 140px"
src="../../groupsData/shx-intern-product-bag-label/logo.svg"
/>
</div>
<h2
style="
position: relative;
left: -5px;
font-size: 80px;
padding-top: 40px;
margin: 0;
font-weight: 200;
"
>
{{PRODUCT_NAME}}
</h2>
<div style="position: relative; top: -10px">
<h3
style="
position: relative;
top: 10px;
font-size: 32px;
font-weight: 600;
letter-spacing: 4px;
"
>
{{PRODUCT_VARIANT}}
</h3>
<h3 style="font-size: 48px; font-weight: 300">
{{PRODUCT_CHARACTERISTIC_LINE_1}}
</h3>
<h3
style="
position: relative;
top: -10px;
font-size: 48px;
font-weight: 300;
"
>
{{PRODUCT_CHARACTERISTIC_LINE_2}}
</h3>
</div>
</div>
<div
style="padding-left: 20px; padding-right: 20px; padding-bottom: 20px"
>
<img src="qrcode.png" style="padding-top: 40px; width: 400px" />
<div style="display: flex; justify-content: right; padding-top: 20px">
<h3 style="font-size: 48px; font-weight: 400; letter-spacing: 4px">
{{DATE}}
</h3>
</div>
<div
style="height: 10px; background-color: #000; border-radius: 50px"
></div>
</div>
</div>
</div>
</body>
</html>

View File

@ -0,0 +1,59 @@
{
"category": "Shinnex",
"name": "Internes Etikett für Produktbeutel",
"globalInputs": [],
"tasks": [
{
"name": "Internes Etikett für Produktbeutel erstellen",
"onFinish": "next",
"undoPossible": false,
"repeatPossible": true,
"scriptPath": "script.py",
"parameters": [
{
"parameterName": "product_type_id",
"type": "select",
"displayName": "Produkttyp auswählen",
"global": false,
"options": [
"#32420 Gizmo die Eidechse, FARBE, Grün/Blau/Orange, (Glänzend)",
"#83650 Gizmo die Eidechse, FARBE, Gold, (Glänzend)",
"#92784 Gizmo die Eidechse, FARBE, Glitzer Grün, (Seidenmatt)",
"#36521 Charlie das Häschen, FARBE, Hellbraun, (Matt)",
"#48273 Charlie das Häschen, FARBE, Gold, (Glänzend)",
"#71936 Ruby die Schlange, FARBE, Feuerrot, (Glänzend)",
"#58324 Ruby die Schlange, FARBE, Rot/Blau, (Glänzend)",
"#78648 Ruby die Schlange, FARBE, Gold, (Glänzend)",
"#21433 Bruno der Dino, FARBE, Grün/Blau/Orange, (Glänzend)",
"#57953 Bruno der Dino, FARBE, Rot/Blau, (Glänzend)",
"#90578 Bruno der Dino, FARBE, Gold, (Glänzend)",
"#51563 Bruno der Dino, FARBE, Himmelblau, (Fluoreszierend)",
"#23564 Flamara der Drache, FARBE, Feuerrot, (Glänzend)",
"#51139 Flamara der Drache, FARBE, Himmelblau, (Fluoreszierend)",
"#77970 Flamara der Drache, FARBE, Gold, (Glänzend)",
"#43356 Flamara der Drache, FARBE, Schwarz, ",
"#32974 Finn der Sad Hamster, STIL, Standard, Weiblich",
"#60798 Finn der Sad Hamster, STIL, Schlüsselanhänger, Weiblich",
"#30563 Finn der Sad Hamster, STIL, Groß, Weiblich",
"#90586 Finn der Sad Hamster, STIL, Standard, Männlich",
"#99560 Finn der Sad Hamster, STIL, Schlüsselanhänger, Männlich",
"#47364 Finn der Sad Hamster, STIL, Groß, Männlich",
"#93047 Mia das Kätzchen, FARBE, Grau, ",
"#86423 Mia das Kätzchen, FARBE, Weiß, ",
"#X38764 Mia das Kätzchen, FARBE, Weiß, (Schlüsselanhänger)",
"#56083 Hoppel das Häschen, FARBE, Grau, ",
"#78693 Elias der Corgi, FARBE, Braun/Weiß, ",
"#37335 Axel der Axolotl, FARBE, Pink, ",
"#26822 Dilo der Delfin, FARBE, Blau ➔ Weiß, ",
"#51665 Sunny das Einhorn, FARBE, Weiß, ",
"#35717 Stella der Phönix, FARBE, Sonderanfertigung, Rosa/Weiß",
"#26843 Stella der Phönix, FARBE, Verlauf Lila/Pink, ",
"#74943 Brain der Fuchs, STIL, Standard, ",
"#78071 Weißer Hund, STIL, Weiß, ",
"#92734 Amigo der Capybara, FARBE, Braun, "
]
}
]
}
]
}

View File

@ -0,0 +1,84 @@
import json
import subprocess
import sys
import os
from datetime import datetime
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../..')))
from libs.utils import utils
json_object = json.loads(sys.argv[1])
product_type_id = json_object["product_type_id"]
if product_type_id is None:
print("Missing required parameters")
sys.exit(1)
product_type_id = product_type_id["value"]
def createHighDpiPng(sourceHtml, outputPng):
# Calculate scaled dimensions
scale_factor = 1
width = int(1020 * scale_factor) # Original width in pixels multiplied by the scale factor
height = int(1020 * scale_factor) # Original height in pixels multiplied by the scale factor
command = [
"google-chrome-stable",
"--headless",
"--no-sandbox",
"--disable-gpu",
"--screenshot=" + outputPng,
"--window-size={},{}".format(width, height), # Set window size to scaled dimensions
"--force-device-scale-factor={}".format(scale_factor), # Set device scale factor
sourceHtml,
]
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
_, stderr = process.communicate()
if process.returncode != 0:
print("Error creating PNG")
print(stderr.decode()) # Decoding the stderr for better readability
sys.exit(1)
if __name__ == "__main__":
utils.move_files_back_from_old_files()
# replace placeholders in index.html
p_type_id = utils.extract_product_id(product_type_id)
data = {
"shx_id": p_type_id
}
utils.create_qrcode(json.dumps(data), "./qrcode.png", "#fff")
with open('../../groupsData/google-sheet-products.json', 'r', encoding='utf-8') as json_file:
data = json.load(json_file)
for product in data["products"]:
if product["id"] == p_type_id:
with open("index.html", "r") as file:
indexhtml = file.read()
indexhtml = indexhtml.replace("{{PRODUCT_ID}}", "#" + product["id"])
indexhtml = indexhtml.replace("{{PRODUCT_NAME}}", product["name"].replace("_", " "))
indexhtml = indexhtml.replace("{{PRODUCT_VARIANT}}", product["product_variant"])
indexhtml = indexhtml.replace("{{PRODUCT_CHARACTERISTIC_LINE_1}}", product["product_characteristic_line_1"])
indexhtml = indexhtml.replace("{{PRODUCT_CHARACTERISTIC_LINE_2}}", product["product_characteristic_line_2"])
now = datetime.now()
formatted_date = now.strftime("%d.%m.%Y")
indexhtml = indexhtml.replace("{{DATE}}", formatted_date)
with open("index.html", "w") as file:
file.write(indexhtml)
break
createHighDpiPng("index.html", "product-bag-label.png")
utils.clear_workspace(["index.html", "qrcode.png"])

View File

@ -140,29 +140,6 @@ def CreateCrmActivityLink(customerId, thirdVoucher):
req("10 € Gutschein", f"https://docs.google.com/forms/d/e/1FAIpQLSd2GXFbidzazuQnh_Lf2mgeA1npuwHkWjsdmjrxDmSkDQTfew/viewform?entry.347359844={orderId}") req("10 € Gutschein", f"https://docs.google.com/forms/d/e/1FAIpQLSd2GXFbidzazuQnh_Lf2mgeA1npuwHkWjsdmjrxDmSkDQTfew/viewform?entry.347359844={orderId}")
def create_qrcode(type, id):
data = f"{QR_CODE_URL}{id}"
# Generate QR code
qr = qrcode.QRCode(
version=1,
error_correction=qrcode.constants.ERROR_CORRECT_L,
box_size=10,
border=0,
)
qr.add_data(data)
qr.make(fit=True)
# Create an image from the QR Code instance
img = qr.make_image(fill_color="black", back_color="#fdf8ef")
# Save image to a file
img.save(f"./{type}.png")
# Display the generated QR code image
#img.show()
def GetCustomerActivityLinks(customerId): def GetCustomerActivityLinks(customerId):
response = requests.get( response = requests.get(
url=f"{ENDPOINT_URL}/customer/view/{customerId}", url=f"{ENDPOINT_URL}/customer/view/{customerId}",
@ -203,9 +180,9 @@ def GetCustomerActivityLinks(customerId):
print("Gift links not found") print("Gift links not found")
sys.exit(1) sys.exit(1)
create_qrcode("5euro", linkGift5["Id"]) utils.create_qrcode(f"{QR_CODE_URL}{linkGift5['Id']}", "./5euro.png", "#fdf8ef")
create_qrcode("10euro", linkGift10["Id"]) utils.create_qrcode(f"{QR_CODE_URL}{linkGift10['Id']}", "./10euro.png", "#fdf8ef")
create_qrcode("10percent", linkGift10Percent["Id"]) utils.create_qrcode(f"{QR_CODE_URL}{linkGift10Percent['Id']}", "./10percent.png", "#fdf8ef")
def ReplaceHtmlVariables(): def ReplaceHtmlVariables():

View File

@ -20,41 +20,41 @@
"type": "select", "type": "select",
"displayName": "Produkttyp auswählen", "displayName": "Produkttyp auswählen",
"options": [ "options": [
"#32420 Gizmo die Eidechse, Farbe, Grün/Blau/Orange, (Glänzend)", "#32420 Gizmo die Eidechse, FARBE, Grün/Blau/Orange, (Glänzend)",
"#83650 Gizmo die Eidechse, Farbe, Gold, (Glänzend)", "#83650 Gizmo die Eidechse, FARBE, Gold, (Glänzend)",
"#92784 Gizmo die Eidechse, Farbe, Glitzer Grün, (Seidenmatt)", "#92784 Gizmo die Eidechse, FARBE, Glitzer Grün, (Seidenmatt)",
"#36521 Charlie das Häschen, Farbe, Hellbraun, (Matt)", "#36521 Charlie das Häschen, FARBE, Hellbraun, (Matt)",
"#48273 Charlie das Häschen, Farbe, Gold, (Glänzend)", "#48273 Charlie das Häschen, FARBE, Gold, (Glänzend)",
"#71936 Ruby die Schlange, Farbe, Feuerrot, (Glänzend)", "#71936 Ruby die Schlange, FARBE, Feuerrot, (Glänzend)",
"#58324 Ruby die Schlange, Farbe, Rot/Blau, (Glänzend)", "#58324 Ruby die Schlange, FARBE, Rot/Blau, (Glänzend)",
"#78648 Ruby die Schlange, Farbe, Gold, (Glänzend)", "#78648 Ruby die Schlange, FARBE, Gold, (Glänzend)",
"#21433 Bruno der Dino, Farbe, Grün/Blau/Orange, (Glänzend)", "#21433 Bruno der Dino, FARBE, Grün/Blau/Orange, (Glänzend)",
"#57953 Bruno der Dino, Farbe, Rot/Blau, (Glänzend)", "#57953 Bruno der Dino, FARBE, Rot/Blau, (Glänzend)",
"#90578 Bruno der Dino, Farbe, Gold, (Glänzend)", "#90578 Bruno der Dino, FARBE, Gold, (Glänzend)",
"#51563 Bruno der Dino, Farbe, Himmelblau, (Fluoreszierend)", "#51563 Bruno der Dino, FARBE, Himmelblau, (Fluoreszierend)",
"#23564 Flamara der Drache, Farbe, Feuerrot, (Glänzend)", "#23564 Flamara der Drache, FARBE, Feuerrot, (Glänzend)",
"#51139 Flamara der Drache, Farbe, Himmelblau, (Fluoreszierend)", "#51139 Flamara der Drache, FARBE, Himmelblau, (Fluoreszierend)",
"#77970 Flamara der Drache, Farbe, Gold, (Glänzend)", "#77970 Flamara der Drache, FARBE, Gold, (Glänzend)",
"#43356 Flamara der Drache, Farbe, Schwarz, ", "#43356 Flamara der Drache, FARBE, Schwarz, ",
"#32974 Finn der Sad Hamster, Stil, Standard, Weiblich", "#32974 Finn der Sad Hamster, STIL, Standard, Weiblich",
"#60798 Finn der Sad Hamster, Stil, Schlüsselanhänger, Weiblich", "#60798 Finn der Sad Hamster, STIL, Schlüsselanhänger, Weiblich",
"#30563 Finn der Sad Hamster, Stil, Groß, Weiblich", "#30563 Finn der Sad Hamster, STIL, Groß, Weiblich",
"#90586 Finn der Sad Hamster, Stil, Standard, Männlich", "#90586 Finn der Sad Hamster, STIL, Standard, Männlich",
"#99560 Finn der Sad Hamster, Stil, Schlüsselanhänger, Männlich", "#99560 Finn der Sad Hamster, STIL, Schlüsselanhänger, Männlich",
"#47364 Finn der Sad Hamster, Stil, Groß, Männlich", "#47364 Finn der Sad Hamster, STIL, Groß, Männlich",
"#93047 Mia das Kätzchen, Farbe, Grau, ", "#93047 Mia das Kätzchen, FARBE, Grau, ",
"#86423 Mia das Kätzchen, Farbe, Weiß, ", "#86423 Mia das Kätzchen, FARBE, Weiß, ",
"#X38764 Mia das Kätzchen, Farbe, Weiß, (Schlüsselanhänger)", "#X38764 Mia das Kätzchen, FARBE, Weiß, (Schlüsselanhänger)",
"#56083 Hoppel das Häschen, Farbe, Grau, ", "#56083 Hoppel das Häschen, FARBE, Grau, ",
"#78693 Elias der Corgi, Farbe, Braun/Weiß, ", "#78693 Elias der Corgi, FARBE, Braun/Weiß, ",
"#37335 Axel der Axolotl, Farbe, Pink, ", "#37335 Axel der Axolotl, FARBE, Pink, ",
"#26822 Dilo der Delfin, Farbe, Blau ➔ Weiß, ", "#26822 Dilo der Delfin, FARBE, Blau ➔ Weiß, ",
"#51665 Sunny das Einhorn, Farbe, Weiß, ", "#51665 Sunny das Einhorn, FARBE, Weiß, ",
"#35717 Stella der Phönix, Farbe, Sonderanfertigung, Rosa/Weiß", "#35717 Stella der Phönix, FARBE, Sonderanfertigung, Rosa/Weiß",
"#26843 Stella der Phönix, Farbe, Verlauf Lila/Pink, ", "#26843 Stella der Phönix, FARBE, Verlauf Lila/Pink, ",
"#74943 Brain der Fuchs, Stil, Standard, ", "#74943 Brain der Fuchs, STIL, Standard, ",
"#78071 Weißer Hund, Stil, Weiß, ", "#78071 Weißer Hund, STIL, Weiß, ",
"#92734 Amigo der Capybara, Farbe, Braun, " "#92734 Amigo der Capybara, FARBE, Braun, "
], ],
"global": false "global": false
} }

View File

@ -42,8 +42,7 @@ if __name__ == "__main__":
utils.move_files_back_from_old_files() utils.move_files_back_from_old_files()
# replace placeholders in index.js # replace placeholders in index.js
p_type_id = utils.extract_product_id(product_type_id)
p_type_id = product_type_id.split(" ")[0].split("#")[1]
print(f"Creating product label for product type #{p_type_id}") print(f"Creating product label for product type #{p_type_id}")

View File

@ -3,245 +3,245 @@
{ {
"id": "32420", "id": "32420",
"name": "Gizmo_die Eidechse", "name": "Gizmo_die Eidechse",
"product_variant": "Farbe", "product_variant": "FARBE",
"product_characteristic_line_1": "Grün/Blau/Orange", "product_characteristic_line_1": "Grün/Blau/Orange",
"product_characteristic_line_2": "(Glänzend)" "product_characteristic_line_2": "(Glänzend)"
}, },
{ {
"id": "83650", "id": "83650",
"name": "Gizmo_die Eidechse", "name": "Gizmo_die Eidechse",
"product_variant": "Farbe", "product_variant": "FARBE",
"product_characteristic_line_1": "Gold", "product_characteristic_line_1": "Gold",
"product_characteristic_line_2": "(Glänzend)" "product_characteristic_line_2": "(Glänzend)"
}, },
{ {
"id": "92784", "id": "92784",
"name": "Gizmo_die Eidechse", "name": "Gizmo_die Eidechse",
"product_variant": "Farbe", "product_variant": "FARBE",
"product_characteristic_line_1": "Glitzer Grün", "product_characteristic_line_1": "Glitzer Grün",
"product_characteristic_line_2": "(Seidenmatt)" "product_characteristic_line_2": "(Seidenmatt)"
}, },
{ {
"id": "36521", "id": "36521",
"name": "Charlie_das Häschen", "name": "Charlie_das Häschen",
"product_variant": "Farbe", "product_variant": "FARBE",
"product_characteristic_line_1": "Hellbraun", "product_characteristic_line_1": "Hellbraun",
"product_characteristic_line_2": "(Matt)" "product_characteristic_line_2": "(Matt)"
}, },
{ {
"id": "48273", "id": "48273",
"name": "Charlie_das Häschen", "name": "Charlie_das Häschen",
"product_variant": "Farbe", "product_variant": "FARBE",
"product_characteristic_line_1": "Gold", "product_characteristic_line_1": "Gold",
"product_characteristic_line_2": "(Glänzend)" "product_characteristic_line_2": "(Glänzend)"
}, },
{ {
"id": "71936", "id": "71936",
"name": "Ruby_die Schlange", "name": "Ruby_die Schlange",
"product_variant": "Farbe", "product_variant": "FARBE",
"product_characteristic_line_1": "Feuerrot", "product_characteristic_line_1": "Feuerrot",
"product_characteristic_line_2": "(Glänzend)" "product_characteristic_line_2": "(Glänzend)"
}, },
{ {
"id": "58324", "id": "58324",
"name": "Ruby_die Schlange", "name": "Ruby_die Schlange",
"product_variant": "Farbe", "product_variant": "FARBE",
"product_characteristic_line_1": "Rot/Blau", "product_characteristic_line_1": "Rot/Blau",
"product_characteristic_line_2": "(Glänzend)" "product_characteristic_line_2": "(Glänzend)"
}, },
{ {
"id": "78648", "id": "78648",
"name": "Ruby_die Schlange", "name": "Ruby_die Schlange",
"product_variant": "Farbe", "product_variant": "FARBE",
"product_characteristic_line_1": "Gold", "product_characteristic_line_1": "Gold",
"product_characteristic_line_2": "(Glänzend)" "product_characteristic_line_2": "(Glänzend)"
}, },
{ {
"id": "21433", "id": "21433",
"name": "Bruno_der Dino", "name": "Bruno_der Dino",
"product_variant": "Farbe", "product_variant": "FARBE",
"product_characteristic_line_1": "Grün/Blau/Orange", "product_characteristic_line_1": "Grün/Blau/Orange",
"product_characteristic_line_2": "(Glänzend)" "product_characteristic_line_2": "(Glänzend)"
}, },
{ {
"id": "57953", "id": "57953",
"name": "Bruno_der Dino", "name": "Bruno_der Dino",
"product_variant": "Farbe", "product_variant": "FARBE",
"product_characteristic_line_1": "Rot/Blau", "product_characteristic_line_1": "Rot/Blau",
"product_characteristic_line_2": "(Glänzend)" "product_characteristic_line_2": "(Glänzend)"
}, },
{ {
"id": "90578", "id": "90578",
"name": "Bruno_der Dino", "name": "Bruno_der Dino",
"product_variant": "Farbe", "product_variant": "FARBE",
"product_characteristic_line_1": "Gold", "product_characteristic_line_1": "Gold",
"product_characteristic_line_2": "(Glänzend)" "product_characteristic_line_2": "(Glänzend)"
}, },
{ {
"id": "51563", "id": "51563",
"name": "Bruno_der Dino", "name": "Bruno_der Dino",
"product_variant": "Farbe", "product_variant": "FARBE",
"product_characteristic_line_1": "Himmelblau", "product_characteristic_line_1": "Himmelblau",
"product_characteristic_line_2": "(Fluoreszierend)" "product_characteristic_line_2": "(Fluoreszierend)"
}, },
{ {
"id": "23564", "id": "23564",
"name": "Flamara_der Drache", "name": "Flamara_der Drache",
"product_variant": "Farbe", "product_variant": "FARBE",
"product_characteristic_line_1": "Feuerrot", "product_characteristic_line_1": "Feuerrot",
"product_characteristic_line_2": "(Glänzend)" "product_characteristic_line_2": "(Glänzend)"
}, },
{ {
"id": "51139", "id": "51139",
"name": "Flamara_der Drache", "name": "Flamara_der Drache",
"product_variant": "Farbe", "product_variant": "FARBE",
"product_characteristic_line_1": "Himmelblau", "product_characteristic_line_1": "Himmelblau",
"product_characteristic_line_2": "(Fluoreszierend)" "product_characteristic_line_2": "(Fluoreszierend)"
}, },
{ {
"id": "77970", "id": "77970",
"name": "Flamara_der Drache", "name": "Flamara_der Drache",
"product_variant": "Farbe", "product_variant": "FARBE",
"product_characteristic_line_1": "Gold", "product_characteristic_line_1": "Gold",
"product_characteristic_line_2": "(Glänzend)" "product_characteristic_line_2": "(Glänzend)"
}, },
{ {
"id": "43356", "id": "43356",
"name": "Flamara_der Drache", "name": "Flamara_der Drache",
"product_variant": "Farbe", "product_variant": "FARBE",
"product_characteristic_line_1": "Schwarz", "product_characteristic_line_1": "Schwarz",
"product_characteristic_line_2": "" "product_characteristic_line_2": ""
}, },
{ {
"id": "32974", "id": "32974",
"name": "Finn der_Sad Hamster", "name": "Finn der_Sad Hamster",
"product_variant": "Stil", "product_variant": "STIL",
"product_characteristic_line_1": "Standard", "product_characteristic_line_1": "Standard",
"product_characteristic_line_2": "Weiblich" "product_characteristic_line_2": "Weiblich"
}, },
{ {
"id": "60798", "id": "60798",
"name": "Finn der_Sad Hamster", "name": "Finn der_Sad Hamster",
"product_variant": "Stil", "product_variant": "STIL",
"product_characteristic_line_1": "Schlüsselanhänger", "product_characteristic_line_1": "Schlüsselanhänger",
"product_characteristic_line_2": "Weiblich" "product_characteristic_line_2": "Weiblich"
}, },
{ {
"id": "30563", "id": "30563",
"name": "Finn der_Sad Hamster", "name": "Finn der_Sad Hamster",
"product_variant": "Stil", "product_variant": "STIL",
"product_characteristic_line_1": "Groß", "product_characteristic_line_1": "Groß",
"product_characteristic_line_2": "Weiblich" "product_characteristic_line_2": "Weiblich"
}, },
{ {
"id": "90586", "id": "90586",
"name": "Finn der_Sad Hamster", "name": "Finn der_Sad Hamster",
"product_variant": "Stil", "product_variant": "STIL",
"product_characteristic_line_1": "Standard", "product_characteristic_line_1": "Standard",
"product_characteristic_line_2": "Männlich" "product_characteristic_line_2": "Männlich"
}, },
{ {
"id": "99560", "id": "99560",
"name": "Finn der_Sad Hamster", "name": "Finn der_Sad Hamster",
"product_variant": "Stil", "product_variant": "STIL",
"product_characteristic_line_1": "Schlüsselanhänger", "product_characteristic_line_1": "Schlüsselanhänger",
"product_characteristic_line_2": "Männlich" "product_characteristic_line_2": "Männlich"
}, },
{ {
"id": "47364", "id": "47364",
"name": "Finn der_Sad Hamster", "name": "Finn der_Sad Hamster",
"product_variant": "Stil", "product_variant": "STIL",
"product_characteristic_line_1": "Groß", "product_characteristic_line_1": "Groß",
"product_characteristic_line_2": "Männlich" "product_characteristic_line_2": "Männlich"
}, },
{ {
"id": "93047", "id": "93047",
"name": "Mia_das Kätzchen", "name": "Mia_das Kätzchen",
"product_variant": "Farbe", "product_variant": "FARBE",
"product_characteristic_line_1": "Grau", "product_characteristic_line_1": "Grau",
"product_characteristic_line_2": "" "product_characteristic_line_2": ""
}, },
{ {
"id": "86423", "id": "86423",
"name": "Mia_das Kätzchen", "name": "Mia_das Kätzchen",
"product_variant": "Farbe", "product_variant": "FARBE",
"product_characteristic_line_1": "Weiß", "product_characteristic_line_1": "Weiß",
"product_characteristic_line_2": "" "product_characteristic_line_2": ""
}, },
{ {
"id": "X38764", "id": "X38764",
"name": "Mia_das Kätzchen", "name": "Mia_das Kätzchen",
"product_variant": "Farbe", "product_variant": "FARBE",
"product_characteristic_line_1": "Weiß", "product_characteristic_line_1": "Weiß",
"product_characteristic_line_2": "(Schlüsselanhänger)" "product_characteristic_line_2": "(Schlüsselanhänger)"
}, },
{ {
"id": "56083", "id": "56083",
"name": "Hoppel_das Häschen", "name": "Hoppel_das Häschen",
"product_variant": "Farbe", "product_variant": "FARBE",
"product_characteristic_line_1": "Grau", "product_characteristic_line_1": "Grau",
"product_characteristic_line_2": "" "product_characteristic_line_2": ""
}, },
{ {
"id": "78693", "id": "78693",
"name": "Elias_der Corgi", "name": "Elias_der Corgi",
"product_variant": "Farbe", "product_variant": "FARBE",
"product_characteristic_line_1": "Braun/Weiß", "product_characteristic_line_1": "Braun/Weiß",
"product_characteristic_line_2": "" "product_characteristic_line_2": ""
}, },
{ {
"id": "37335", "id": "37335",
"name": "Axel_der Axolotl", "name": "Axel_der Axolotl",
"product_variant": "Farbe", "product_variant": "FARBE",
"product_characteristic_line_1": "Pink", "product_characteristic_line_1": "Pink",
"product_characteristic_line_2": "" "product_characteristic_line_2": ""
}, },
{ {
"id": "26822", "id": "26822",
"name": "Dilo_der Delfin", "name": "Dilo_der Delfin",
"product_variant": "Farbe", "product_variant": "FARBE",
"product_characteristic_line_1": "Blau ➔ Weiß", "product_characteristic_line_1": "Blau ➔ Weiß",
"product_characteristic_line_2": "" "product_characteristic_line_2": ""
}, },
{ {
"id": "51665", "id": "51665",
"name": "Sunny_das Einhorn", "name": "Sunny_das Einhorn",
"product_variant": "Farbe", "product_variant": "FARBE",
"product_characteristic_line_1": "Weiß", "product_characteristic_line_1": "Weiß",
"product_characteristic_line_2": "" "product_characteristic_line_2": ""
}, },
{ {
"id": "35717", "id": "35717",
"name": "Stella_der Phönix", "name": "Stella_der Phönix",
"product_variant": "Farbe", "product_variant": "FARBE",
"product_characteristic_line_1": "Sonderanfertigung", "product_characteristic_line_1": "Sonderanfertigung",
"product_characteristic_line_2": "Rosa/Weiß" "product_characteristic_line_2": "Rosa/Weiß"
}, },
{ {
"id": "26843", "id": "26843",
"name": "Stella_der Phönix", "name": "Stella_der Phönix",
"product_variant": "Farbe", "product_variant": "FARBE",
"product_characteristic_line_1": "Verlauf Lila/Pink", "product_characteristic_line_1": "Verlauf Lila/Pink",
"product_characteristic_line_2": "" "product_characteristic_line_2": ""
}, },
{ {
"id": "74943", "id": "74943",
"name": "Brain_der Fuchs", "name": "Brain_der Fuchs",
"product_variant": "Stil", "product_variant": "STIL",
"product_characteristic_line_1": "Standard", "product_characteristic_line_1": "Standard",
"product_characteristic_line_2": "" "product_characteristic_line_2": ""
}, },
{ {
"id": "78071", "id": "78071",
"name": "Weißer_Hund", "name": "Weißer_Hund",
"product_variant": "Stil", "product_variant": "STIL",
"product_characteristic_line_1": "Weiß", "product_characteristic_line_1": "Weiß",
"product_characteristic_line_2": "" "product_characteristic_line_2": ""
}, },
{ {
"id": "92734", "id": "92734",
"name": "Amigo_der Capybara", "name": "Amigo_der Capybara",
"product_variant": "Farbe", "product_variant": "FARBE",
"product_characteristic_line_1": "Braun", "product_characteristic_line_1": "Braun",
"product_characteristic_line_2": "" "product_characteristic_line_2": ""
} }

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 177 KiB

View File

@ -3,6 +3,7 @@ import PyPDF2
import os import os
import shutil import shutil
import sys import sys
import qrcode
def clear_workspace(files): def clear_workspace(files):
@ -70,12 +71,10 @@ def execute_python_file(file_path):
if not os.path.exists(file_path): if not os.path.exists(file_path):
print(f"The file {file_path} does not exist.") print(f"The file {file_path} does not exist.")
sys.exit(1) sys.exit(1)
return
if not file_path.endswith('.py'): if not file_path.endswith('.py'):
print("The specified file is not a Python file.") print("The specified file is not a Python file.")
sys.exit(1) sys.exit(1)
return
try: try:
#base_dir = os.path.dirname(os.path.abspath(file_path)) #base_dir = os.path.dirname(os.path.abspath(file_path))
@ -93,12 +92,10 @@ def copy_files(source_folder, destination_folder):
if not os.path.exists(source_folder): if not os.path.exists(source_folder):
print(f"The source folder {source_folder} does not exist.") print(f"The source folder {source_folder} does not exist.")
sys.exit(1) sys.exit(1)
return
if not os.path.exists(destination_folder): if not os.path.exists(destination_folder):
print(f"The destination folder {destination_folder} does not exist.") print(f"The destination folder {destination_folder} does not exist.")
sys.exit(1) sys.exit(1)
return
try: try:
# List all files in the source folder # List all files in the source folder
@ -113,3 +110,29 @@ def copy_files(source_folder, destination_folder):
except Exception as e: except Exception as e:
print(f"An error occurred while copying files: {e}") print(f"An error occurred while copying files: {e}")
sys.exit(1) sys.exit(1)
# this will extract the product id from the string which is provided as arg from the select dropdown where the user can select a product
def extract_product_id(product_type_id):
return product_type_id.split(" ")[0].split("#")[1]
def create_qrcode(qr_code_url, save_path, back_color):
data = qr_code_url
# Generate QR code
qr = qrcode.QRCode(
version=1,
error_correction=qrcode.constants.ERROR_CORRECT_L,
box_size=10,
border=0,
)
qr.add_data(data)
qr.make(fit=True)
# Create an image from the QR Code instance
img = qr.make_image(fill_color="black", back_color=back_color)
# Save image to a file
# like ./test.png
img.save(save_path)