mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-18 13:07:12 +00:00
now reading .xml drawings as utf-8 not binary, after correcting corrupt files
This commit is contained in:
@@ -221,9 +221,9 @@ def settherionfileinfo(filetuple):
|
||||
therionfile.save()
|
||||
|
||||
|
||||
rx_skpath = re.compile(rb"<skpath")
|
||||
rx_pcpath = re.compile(rb'<pcarea area_signal="frame".*?sfsketch="([^"]*)" sfstyle="([^"]*)"')
|
||||
rx_pctext = re.compile(rb'pctext.*?\*ref&space;([^&]*)')
|
||||
rx_skpath = re.compile(r"<skpath")
|
||||
rx_pcpath = re.compile(r'<pcarea area_signal="frame".*?sfsketch="([^"]*)" sfstyle="([^"]*)"')
|
||||
rx_pctext = re.compile(r'pctext.*?\*ref&space;([^&]*)')
|
||||
|
||||
|
||||
def settnlfileinfo(dwgfile):
|
||||
@@ -243,7 +243,7 @@ def settnlfileinfo(dwgfile):
|
||||
print(message)
|
||||
DataIssue.objects.create(parser="Tunnel", message=message, url=f"/dwgdataraw/{dwgfile.dwgpath}")
|
||||
return
|
||||
fin = open(ff, "rb") # tunnel files are not actually ascii, despite what they say. They have weird bytes in them.
|
||||
fin = open(ff, "r") # tunnel files are now all utf-8 after fixup 24/10/2025.
|
||||
ttext = fin.read()
|
||||
fin.close()
|
||||
|
||||
@@ -256,18 +256,18 @@ def settnlfileinfo(dwgfile):
|
||||
|
||||
# sfsketch="surveyscans/2025/2025#41/plan_diddlypot.png"
|
||||
for scanfile_path, style in rx_pcpath.findall(ttext):
|
||||
parse_tnl_file(dwgfile, scanfile_path.decode())
|
||||
parse_tnl_file(dwgfile, scanfile_path)
|
||||
|
||||
# <pathcodes>
|
||||
# <pctext style="survey" nodeposxrel="-1.0" nodeposyrel="-1.0"> *file_begin "/home/expo/loser/caves-1623/2025-dw-01/trip1.svx" "trip1.svx" | *begin 1 | *export 1 25 | | ; Cave: 2025-dw-01 | ; Area in cave/QM: Entrance series | *title "2025-dw-01" | *date 2025.07.13 | *team "Dylan Wase" notes | *team "Daniel Gorst" dog | *instrument SAP "SAP6 Dylan" | *ref 2025#20 |
|
||||
for refs in rx_pctext.findall(ttext):
|
||||
try:
|
||||
wallets = Wallet.objects.filter(walletname=refs.decode())
|
||||
wallets = Wallet.objects.filter(walletname=refs)
|
||||
if wallets:
|
||||
for w in wallets:
|
||||
dwgfile.dwgwallets.add(w)
|
||||
except:
|
||||
message = f" ! wallet not found referenced from {dwgfile} -- '{refs.decode()}' "
|
||||
message = f" ! wallet not found referenced from {dwgfile} -- '{refs}' "
|
||||
print(message)
|
||||
DataIssue.objects.create(parser="Tunnel", message=message, url=f"/dwgdataraw/{dwgfile}")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user