kopia lustrzana https://github.com/OpenDroneMap/WebODM
minWebodmVersion check in plugins
rodzic
66c2178da1
commit
e03e884ffc
1
VERSION
1
VERSION
|
@ -1 +0,0 @@
|
|||
0.4.1
|
|
@ -28,6 +28,8 @@ def boot():
|
|||
booted.value = True
|
||||
logger = logging.getLogger('app.logger')
|
||||
|
||||
logger.info("Booting WebODM {}".format(settings.VERSION))
|
||||
|
||||
if settings.DEBUG:
|
||||
logger.warning("Debug mode is ON (for development this is OK)")
|
||||
|
||||
|
@ -59,14 +61,13 @@ def boot():
|
|||
# Add default presets
|
||||
Preset.objects.get_or_create(name='DSM + DTM', system=True,
|
||||
options=[{'name': 'dsm', 'value': True}, {'name': 'dtm', 'value': True}])
|
||||
Preset.objects.get_or_create(name='Fast Orthophoto', system=True,
|
||||
options=[{'name': 'fast-orthophoto', 'value': True}])
|
||||
Preset.objects.get_or_create(name='High Quality', system=True,
|
||||
options=[{'name': 'dsm', 'value': True},
|
||||
{'name': 'skip-resize', 'value': True},
|
||||
{'name': 'mesh-octree-depth', 'value': "12"},
|
||||
{'name': 'use-25dmesh', 'value': True},
|
||||
{'name': 'min-num-features', 'value': 8000},
|
||||
{'name': 'dem-resolution', 'value': "0.04"},
|
||||
{'name': 'orthophoto-resolution', 'value': "60"},
|
||||
{'name': 'orthophoto-resolution', 'value': "40"},
|
||||
])
|
||||
Preset.objects.get_or_create(name='Default', system=True, options=[{'name': 'dsm', 'value': True}])
|
||||
|
||||
|
|
|
@ -3,7 +3,11 @@ import logging
|
|||
import importlib
|
||||
|
||||
import django
|
||||
import json
|
||||
from django.conf.urls import url
|
||||
from functools import reduce
|
||||
|
||||
from webodm import settings
|
||||
|
||||
logger = logging.getLogger('app.logger')
|
||||
|
||||
|
@ -49,6 +53,16 @@ def get_active_plugins():
|
|||
if os.path.isfile(disabled_path):
|
||||
continue
|
||||
|
||||
# Read manifest
|
||||
with open(manifest_path) as manifest_file:
|
||||
manifest = json.load(manifest_file)
|
||||
if 'webodmMinVersion' in manifest:
|
||||
min_version = manifest['webodmMinVersion']
|
||||
|
||||
if versionToInt(min_version) > versionToInt(settings.VERSION):
|
||||
logger.warning("In {} webodmMinVersion is set to {} but WebODM version is {}. Plugin will not be loaded. Update WebODM.".format(manifest_path, min_version, settings.VERSION))
|
||||
continue
|
||||
|
||||
# Instantiate the plugin
|
||||
try:
|
||||
module = importlib.import_module("plugins.{}".format(dir))
|
||||
|
@ -63,3 +77,23 @@ def get_active_plugins():
|
|||
def get_plugins_path():
|
||||
current_path = os.path.dirname(os.path.realpath(__file__))
|
||||
return os.path.abspath(os.path.join(current_path, "..", "..", "plugins"))
|
||||
|
||||
|
||||
def versionToInt(version):
|
||||
"""
|
||||
Converts a WebODM version string (major.minor.build) to a integer value
|
||||
for comparison
|
||||
>>> versionToInt("1.2.3")
|
||||
100203
|
||||
>>> versionToInt("1")
|
||||
100000
|
||||
>>> versionToInt("1.2.3.4")
|
||||
100203
|
||||
>>> versionToInt("wrong")
|
||||
-1
|
||||
"""
|
||||
|
||||
try:
|
||||
return sum([reduce(lambda mult, ver: mult * ver, i) for i in zip([100000, 100, 1], map(int, version.split(".")))])
|
||||
except:
|
||||
return -1
|
|
@ -90,7 +90,6 @@
|
|||
<script src="{% static 'app/js/vendor/metisMenu.min.js' %}"></script>
|
||||
<script>
|
||||
$(function(){
|
||||
return;
|
||||
$('#side-menu').metisMenu();
|
||||
|
||||
$(window).bind("load resize", function() {
|
||||
|
|
|
@ -10,7 +10,7 @@ For the full list of settings and their values, see
|
|||
https://docs.djangoproject.com/en/1.10/ref/settings/
|
||||
"""
|
||||
|
||||
import os, sys
|
||||
import os, sys, json
|
||||
|
||||
import datetime
|
||||
|
||||
|
@ -40,7 +40,9 @@ except ImportError:
|
|||
|
||||
print("Generated secret key")
|
||||
|
||||
|
||||
with open(os.path.join(BASE_DIR, 'package.json')) as package_file:
|
||||
data = json.load(package_file)
|
||||
VERSION = data['version']
|
||||
|
||||
TESTING = sys.argv[1:2] == ['test']
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue