From d1f3f4d847cbeff3a1d782da1cbd98e92d26615f Mon Sep 17 00:00:00 2001 From: mistangl Date: Wed, 2 Jul 2025 09:40:33 +0200 Subject: [PATCH] =?UTF-8?q?erste=20Fassung=20von=20portalexport.bat=20dazu?= =?UTF-8?q?.=20weniger=20restrikitver=20Regul=C3=A4rerer=20Ausdruck=20f?= =?UTF-8?q?=C3=BCr=20die=20PFade?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bin/portalexport.bat | 48 ++++++++++++++++++++++++++++++++++++++++++++ lib/getpositions.py | 2 +- 2 files changed, 49 insertions(+), 1 deletion(-) create mode 100644 bin/portalexport.bat diff --git a/bin/portalexport.bat b/bin/portalexport.bat new file mode 100644 index 0000000..946d674 --- /dev/null +++ b/bin/portalexport.bat @@ -0,0 +1,48 @@ +@echo off + +if [%1]==[] goto usage +for %%i in ("%~1") do ( + set "FILENAME=%%~ni" + set "EXT=%%~xi" + set "DIR=%%~dpi" +) + +REM echo Dateiname ohne Erweiterung: %FILENAME% +REM echo Erweiterung: %EXT% +REM echo Verzeichnis: %DIR% +REM +REM Namen der Zwischenergebnis Dateien +set JSON_POS=%FILENAME%_positions.json +set JSON_TODRAW=%FILENAME%_todraw.json +REM Namen der Ergebnisdateien +set ERROR_DOUBLE=%FILENAME%_errors.json + + +call C:\10-Develop\gitrepos\kabellaengen\bin\setenv.bat + + +echo --hole Positionen +call portalexport.bat --filename %1 -w %JSON_POS% -e %ERROR_DOUBLE% +if exist "%PROJECT_WORK%\%ERROR_DOUBLE%" ( + @echo -failed- given items with the same ids + pause + move %PROJECT_WORK%\%ERROR_DOUBLE% %INSTALL_DIR% + goto :eof +) +if not exist "%PROJECT_WORK%\%JSON_POS%" ( + @echo -failed- getpositions + pause + goto :eof +) + +mkdir %INSTALL_DIR%\%FILENAME% +move %PROJECT_WORK%\%FILENAME%_* %INSTALL_DIR%\%FILENAME% +goto :eof + + +:usage +@echo Usage: %0 ^ +exit /B 1 +goto :eof + + diff --git a/lib/getpositions.py b/lib/getpositions.py index 92af40b..b91808d 100644 --- a/lib/getpositions.py +++ b/lib/getpositions.py @@ -205,7 +205,7 @@ def create_mappings(positions:dict) -> tuple: #print(unterverteiler_pfad) # Pfad zur Karte splitten. Dieser hat z.B. den Inhalt "=AH01+UH02-KF1FDI7" - pattern = r"^=([A-Z]+\d+)([+\-])([A-Z]+\d+)([+\-])([A-Z0-9]+)$" + pattern = r"^=([A-Z]+\d+)([+\-])([A-Z]+\d+)([+\-])([A-Z]+\d+.)$" match = re.match(pattern, unterverteiler_pfad) if match: anlage = match.group(1)