2
0
mirror of https://expo.survex.com/repositories/troggle/.git synced 2024-11-22 07:11:52 +00:00

scanned image files importing

This commit is contained in:
Philip Sargent 2020-04-09 02:40:32 +01:00
parent fbe6c0c859
commit d71e31417b
5 changed files with 23 additions and 11 deletions

View File

@ -182,10 +182,10 @@ def usage():
people - read in the people from folk.csv people - read in the people from folk.csv
QMs - read in the QM files QMs - read in the QM files
resetend resetend
scans - read in the scanned surveynotes scans - NOT the scanned surveynotes ?!
survex - read in the survex files survex - read in the survex files
survexpos survexpos
surveys surveys - read in the scanned surveynotes
tunnel - read in the Tunnel files tunnel - read in the Tunnel files
""") """)

View File

@ -149,6 +149,7 @@ def RecursiveLoad(survexblock, survexfile, fin, textlines):
survexblock.survexscansfolder = survexscansfolders[0] survexblock.survexscansfolder = survexscansfolders[0]
#survexblock.refscandir = "%s/%s%%23%s" % (mref.group(1), mref.group(1), mref.group(2)) #survexblock.refscandir = "%s/%s%%23%s" % (mref.group(1), mref.group(1), mref.group(2))
survexblock.save() survexblock.save()
print('Wallet *ref - %s' % refscan)
continue continue
# This whole section should be moved if we can have *QM become a proper survex command # This whole section should be moved if we can have *QM become a proper survex command

View File

@ -99,19 +99,30 @@ def parseSurveyScans(expedition, logfile=None):
#scanList = listdir(expedition.year, surveyFolder) #scanList = listdir(expedition.year, surveyFolder)
scanList=os.listdir(os.path.join(yearPath,surveyFolder)) scanList=os.listdir(os.path.join(yearPath,surveyFolder))
except AttributeError: except AttributeError:
print("Folder: " + surveyFolder + " ignored\r") print("Ignoring file in year folder: " + surveyFolder + "\r")
continue continue
for scan in scanList: 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: 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 scanType,scanNumber,scanFormat=scanChopped
except AttributeError: except AttributeError:
print("File: " + scan + " ignored\r") print("Ignored (bad name format): " + surveyFolder + '/' + scan + "\r")
continue continue
if scanType == 'elev' or scanType == 'extend': scanTest = scanType
scanType = 'notes'
match = re.search(r'(?i)(elev|extend)',scanTest)
if match:
scanType = 'elevation' scanType = 'elevation'
match = re.search(r'(?i)(plan)',scanTest)
if match:
scanType = 'plan'
if scanNumber=='': if scanNumber=='':
scanNumber=1 scanNumber=1

View File

@ -2,11 +2,11 @@
{% load wiki_markup %} {% load wiki_markup %}
{% load survex_markup %} {% load survex_markup %}
{% block title %}Survex Scans Folder{% endblock %} {% block title %}Survey Scans Folder{% endblock %}
{% block content %} {% block content %}
<h3>Survex Scans in: {{survexscansfolder.walletname}}</h3> <h3>Survey Scans in: {{survexscansfolder.walletname}}</h3>
<table> <table>
{% for survexscansingle in survexscansfolder.survexscansingle_set.all %} {% for survexscansingle in survexscansfolder.survexscansingle_set.all %}
<tr> <tr>
@ -20,7 +20,7 @@
{% endfor %} {% endfor %}
</table> </table>
<h3>Surveys referring to this wallet</h3> <h3>Survex surveys referring to this wallet</h3>
<table> <table>
{% for survexblock in survexscansfolder.survexblock_set.all %} {% for survexblock in survexscansfolder.survexblock_set.all %}

View File

@ -2,11 +2,11 @@
{% load wiki_markup %} {% load wiki_markup %}
{% load survex_markup %} {% load survex_markup %}
{% block title %}All Survex scans folders{% endblock %} {% block title %}All Survey scans folders{% endblock %}
{% block content %} {% block content %}
<h3>All Survex scans folders</h3> <h3>All Survey scans folders</h3>
<table> <table>
<tr><th>Scans folder</th><th>Files</th><th>Survex blocks</th></tr> <tr><th>Scans folder</th><th>Files</th><th>Survex blocks</th></tr>
{% for survexscansfolder in survexscansfolders %} {% for survexscansfolder in survexscansfolders %}