add Brazil & Argentina plate format
This commit is contained in:
2
.env
2
.env
@@ -15,7 +15,7 @@ DB_NAME=controlpatente
|
|||||||
JWT_SECRET=d95810e29f700cb99d3ed6a891ace603522875069ec655887a01629891a38ce8
|
JWT_SECRET=d95810e29f700cb99d3ed6a891ace603522875069ec655887a01629891a38ce8
|
||||||
|
|
||||||
# Admin password (optional - if not set, a random password will be generated on first run)
|
# Admin password (optional - if not set, a random password will be generated on first run)
|
||||||
# ADMIN_PASSWORD=
|
# ADMIN_PASSWORD=HnXlU0BtE5-PtQ8n
|
||||||
|
|
||||||
# Allowed origins for CORS (comma-separated)
|
# Allowed origins for CORS (comma-separated)
|
||||||
ALLOWED_ORIGINS=http://localhost:5173,http://127.0.0.1:5173,https://demo.v1ru5.cl
|
ALLOWED_ORIGINS=http://localhost:5173,http://127.0.0.1:5173,https://demo.v1ru5.cl
|
||||||
|
|||||||
@@ -143,8 +143,16 @@ def send_plate(plate_number):
|
|||||||
print(f"✗ Error sending plate: {e}")
|
print(f"✗ Error sending plate: {e}")
|
||||||
|
|
||||||
def validate_plate(text):
|
def validate_plate(text):
|
||||||
"""Valida formato chileno"""
|
"""Valida formatos de patentes de Chile, Argentina y Brasil"""
|
||||||
return bool(re.match(r'^[A-Z]{4}\d{2}$', text) or re.match(r'^[A-Z]{2}\d{4}$', text))
|
# Chile formato nuevo: XXXX00 (4 letras, 2 números)
|
||||||
|
# Chile formato antiguo: XX0000 (2 letras, 4 números)
|
||||||
|
# Argentina Mercosur: AA000AA (2 letras, 3 números, 2 letras)
|
||||||
|
# Brasil Mercosur: AAA0A00 (3 letras, 1 número, 1 letra, 2 números)
|
||||||
|
chile_new = re.match(r'^[A-Z]{4}\d{2}$', text)
|
||||||
|
chile_old = re.match(r'^[A-Z]{2}\d{4}$', text)
|
||||||
|
argentina = re.match(r'^[A-Z]{2}\d{3}[A-Z]{2}$', text)
|
||||||
|
brasil = re.match(r'^[A-Z]{3}\d[A-Z]\d{2}$', text)
|
||||||
|
return bool(chile_new or chile_old or argentina or brasil)
|
||||||
|
|
||||||
def ocr_worker(reader, worker_id):
|
def ocr_worker(reader, worker_id):
|
||||||
"""Hilo dedicado para OCR - múltiples workers para mejor rendimiento"""
|
"""Hilo dedicado para OCR - múltiples workers para mejor rendimiento"""
|
||||||
|
|||||||
Reference in New Issue
Block a user