mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-12-14 01:37:08 +00:00
scanned image files importing
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user