summaryrefslogtreecommitdiffstats
path: root/parsers
diff options
context:
space:
mode:
authorPhilip Sargent <philip.sargent@gmail.com>2020-04-09 02:40:32 +0100
committerPhilip Sargent <philip.sargent@gmail.com>2020-04-09 02:40:32 +0100
commitd71e31417b1fce145dd75661d33f2c01f83cdf57 (patch)
tree3ea4b951d40e0b48448b84f2efda71427f47d8fc /parsers
parentfbe6c0c85921fa35b0aafbc597eb9f6e4482aa5d (diff)
downloadtroggle-d71e31417b1fce145dd75661d33f2c01f83cdf57.tar.gz
troggle-d71e31417b1fce145dd75661d33f2c01f83cdf57.tar.bz2
troggle-d71e31417b1fce145dd75661d33f2c01f83cdf57.zip
scanned image files importing
Diffstat (limited to 'parsers')
-rw-r--r--parsers/survex.py1
-rw-r--r--parsers/surveys.py19
2 files changed, 16 insertions, 4 deletions
diff --git a/parsers/survex.py b/parsers/survex.py
index 14bd035..1a6118c 100644
--- a/parsers/survex.py
+++ b/parsers/survex.py
@@ -149,6 +149,7 @@ def RecursiveLoad(survexblock, survexfile, fin, textlines):
survexblock.survexscansfolder = survexscansfolders[0]
#survexblock.refscandir = "%s/%s%%23%s" % (mref.group(1), mref.group(1), mref.group(2))
survexblock.save()
+ print('Wallet *ref - %s' % refscan)
continue
# This whole section should be moved if we can have *QM become a proper survex command
diff --git a/parsers/surveys.py b/parsers/surveys.py
index d88aab3..be8a368 100644
--- a/parsers/surveys.py
+++ b/parsers/surveys.py
@@ -99,19 +99,30 @@ def parseSurveyScans(expedition, logfile=None):
#scanList = listdir(expedition.year, surveyFolder)
scanList=os.listdir(os.path.join(yearPath,surveyFolder))
except AttributeError:
- print("Folder: " + surveyFolder + " ignored\r")
+ print("Ignoring file in year folder: " + surveyFolder + "\r")
continue
for scan in scanList:
+ # Why does this insist on renaming all the scanned image files?
+ # It produces duplicates names and all images have type .jpg in the scanObj.
+ # It seems to rely on end users being particularly diligent in filenames which is NGtH
try:
- scanChopped=re.match(r'(?i).*(notes|elev|plan|elevation|extend)(\d*)\.(png|jpg|jpeg)',scan).groups()
+ #scanChopped=re.match(r'(?i).*(notes|elev|plan|extend|elevation)-?(\d*)\.(png|jpg|jpeg|pdf)',scan).groups()
+ scanChopped=re.match(r'(?i)([a-z_-]*\d?[a-z_-]*)(\d*)\.(png|jpg|jpeg|pdf|top|dxf|svg|tdr|th2|xml|txt)',scan).groups()
scanType,scanNumber,scanFormat=scanChopped
except AttributeError:
- print("File: " + scan + " ignored\r")
+ print("Ignored (bad name format): " + surveyFolder + '/' + scan + "\r")
continue
- if scanType == 'elev' or scanType == 'extend':
+ scanTest = scanType
+ scanType = 'notes'
+ match = re.search(r'(?i)(elev|extend)',scanTest)
+ if match:
scanType = 'elevation'
+ match = re.search(r'(?i)(plan)',scanTest)
+ if match:
+ scanType = 'plan'
+
if scanNumber=='':
scanNumber=1