|
|
@@ -1,6 +1,5 @@
|
|
|
import io
|
|
|
import json
|
|
|
-import logging
|
|
|
import zipfile
|
|
|
from datetime import datetime
|
|
|
from pathlib import Path
|
|
|
@@ -31,8 +30,6 @@ from backend.app.schemas.settings import AppSettings, AppSettingsUpdate
|
|
|
from backend.app.services.printer_manager import printer_manager
|
|
|
from backend.app.services.spoolman import init_spoolman_client
|
|
|
|
|
|
-logger = logging.getLogger(__name__)
|
|
|
-
|
|
|
router = APIRouter(prefix="/settings", tags=["settings"])
|
|
|
|
|
|
# Default settings
|
|
|
@@ -929,7 +926,6 @@ async def import_backup(
|
|
|
filename = zip_path.replace("plate_calibration/", "", 1)
|
|
|
if filename: # Skip directory entries
|
|
|
plate_cal_files[filename] = zf.read(zip_path)
|
|
|
- logger.info(f"Stored plate calibration file for later: {filename}")
|
|
|
continue
|
|
|
target_path = base_dir / zip_path
|
|
|
target_path.parent.mkdir(parents=True, exist_ok=True)
|
|
|
@@ -1078,7 +1074,6 @@ async def import_backup(
|
|
|
await db.flush()
|
|
|
|
|
|
# Restore plate calibration files (remap printer IDs based on serial numbers)
|
|
|
- logger.info(f"Plate calibration files to restore: {len(plate_cal_files)} files: {list(plate_cal_files.keys())}")
|
|
|
if plate_cal_files:
|
|
|
# Build serial_number -> new_printer_id mapping
|
|
|
serial_to_new_id: dict[str, int] = {}
|
|
|
@@ -1101,9 +1096,6 @@ async def import_backup(
|
|
|
if serial and serial in serial_to_new_id:
|
|
|
old_id_to_new_id[old_id] = serial_to_new_id[serial]
|
|
|
|
|
|
- logger.info(
|
|
|
- f"Plate calibration ID mapping: old_id_to_serial={old_id_to_serial}, serial_to_new_id={serial_to_new_id}, old_id_to_new_id={old_id_to_new_id}"
|
|
|
- )
|
|
|
app_settings.plate_calibration_dir.mkdir(parents=True, exist_ok=True)
|
|
|
|
|
|
for filename, file_data in plate_cal_files.items():
|
|
|
@@ -1119,7 +1111,6 @@ async def import_backup(
|
|
|
new_filename = filename.replace(f"printer_{old_printer_id}_", f"printer_{new_printer_id}_", 1)
|
|
|
|
|
|
target_path = app_settings.plate_calibration_dir / new_filename
|
|
|
- logger.info(f"Writing plate calibration file: {filename} -> {target_path}")
|
|
|
with open(target_path, "wb") as f:
|
|
|
f.write(file_data)
|
|
|
files_restored += 1
|