diff --git a/parsers/surveys.py b/parsers/surveys.py index efa8232..1e1ac22 100644 --- a/parsers/surveys.py +++ b/parsers/surveys.py @@ -196,7 +196,6 @@ def GetListDir(sdir): def LoadListScansFile(survexscansfolder): gld = [ ] - # flatten out any directories in these wallet folders - should not be any for (fyf, ffyf, fisdiryf) in GetListDir(survexscansfolder.fpath): if fisdiryf: @@ -204,24 +203,31 @@ def LoadListScansFile(survexscansfolder): else: gld.append((fyf, ffyf, fisdiryf)) + c=0 for (fyf, ffyf, fisdiryf) in gld: #assert not fisdiryf, ffyf - if re.search(r"\.(?:png|jpg|jpeg|pdf|jpeg|svg)(?i)$", fyf): + if re.search(r"\.(?:png|jpg|jpeg|pdf|svg|gif)(?i)$", fyf): survexscansingle = SurvexScanSingle(ffile=ffyf, name=fyf, survexscansfolder=survexscansfolder) survexscansingle.save() + c+=1 + if c>=10: + print(".", end=' ') + c = 0 # this iterates through the scans directories (either here or on the remote server) # and builds up the models we can access later def LoadListScans(): - print(' - Loading Survey Scans... (deleting all objects first)') + print(' - Loading Survey Scans') SurvexScanSingle.objects.all().delete() SurvexScansFolder.objects.all().delete() + print(' - deleting all scansFolder and scansSingle objects') # first do the smkhs (large kh survey scans) directory survexscansfoldersmkhs = SurvexScansFolder(fpath=os.path.join(settings.SURVEY_SCANS, "../surveys/smkhs"), walletname="smkhs") + print("smkhs", end=' ') if os.path.isdir(survexscansfoldersmkhs.fpath): survexscansfoldersmkhs.save() LoadListScansFile(survexscansfoldersmkhs)