kopia lustrzana https://github.com/OpenDroneMap/ODM
rodzic
f9d2d416e9
commit
0622690688
|
@ -11,6 +11,12 @@ with open(context.settings_path) as stream:
|
||||||
datamap = yaml.safe_load(stream)
|
datamap = yaml.safe_load(stream)
|
||||||
defaultSettings = datamap['settings']
|
defaultSettings = datamap['settings']
|
||||||
|
|
||||||
|
def alphanumeric_string(string):
|
||||||
|
import re
|
||||||
|
if re.match('^[a-zA-Z0-9]+$', str) is None:
|
||||||
|
msg = '{0} is not a valid name. Must use alphanumeric characters.'.format(string)
|
||||||
|
raise argparse.ArgumentTypeError(msg)
|
||||||
|
return string
|
||||||
|
|
||||||
class RerunFrom(argparse.Action):
|
class RerunFrom(argparse.Action):
|
||||||
def __call__(self, parser, namespace, values, option_string=None):
|
def __call__(self, parser, namespace, values, option_string=None):
|
||||||
|
@ -30,6 +36,11 @@ def config():
|
||||||
help='Path to the project to process',
|
help='Path to the project to process',
|
||||||
default=defaultSettings[0]['project_path'])
|
default=defaultSettings[0]['project_path'])
|
||||||
|
|
||||||
|
parser.add_argument('name',
|
||||||
|
metavar='<string>',
|
||||||
|
type=alphanumeric_string,
|
||||||
|
help='Name of Project (i.e subdirectory of projects folder)')
|
||||||
|
|
||||||
parser.add_argument('--resize-to', # currently doesn't support 'orig'
|
parser.add_argument('--resize-to', # currently doesn't support 'orig'
|
||||||
metavar='<integer>',
|
metavar='<integer>',
|
||||||
default=2400,
|
default=2400,
|
||||||
|
|
11
run.py
11
run.py
|
@ -13,7 +13,8 @@ from scripts.odm_app import ODMApp
|
||||||
|
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
log.ODM_ERROR('USAGE: %s --project-path [project_path]' % sys.argv[0])
|
log.ODM_ERROR('You must specify a project name:')
|
||||||
|
log.ODM_ERROR('USAGE: %s [project name]' % sys.argv[0])
|
||||||
log.ODM_ERROR('OpenDroneMap app finished - %s' % system.now())
|
log.ODM_ERROR('OpenDroneMap app finished - %s' % system.now())
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
|
@ -24,11 +25,15 @@ if __name__ == '__main__':
|
||||||
|
|
||||||
args = config.config()
|
args = config.config()
|
||||||
|
|
||||||
|
# Check that args.name is a valid string
|
||||||
|
|
||||||
|
proj_dir = io.join_paths(args.project_path, args.name)
|
||||||
|
|
||||||
# Force to provide the images path
|
# Force to provide the images path
|
||||||
if args.project_path is None:
|
if args.project_path is None:
|
||||||
usage()
|
usage()
|
||||||
elif not io.dir_exists(args.project_path):
|
if not io.dir_exists(args.name):
|
||||||
log.ODM_WARNING('Directory %s does not exist. Creating it now.' % args.project_path)
|
log.ODM_WARNING('Directory %s does not exist. Creating it now.' % args.name)
|
||||||
system.mkdir_p(os.path.abspath(args.project_path))
|
system.mkdir_p(os.path.abspath(args.project_path))
|
||||||
|
|
||||||
#If user asks to rerun everything, delete all of the existing progress directories.
|
#If user asks to rerun everything, delete all of the existing progress directories.
|
||||||
|
|
Ładowanie…
Reference in New Issue