kopia lustrzana https://github.com/OpenDroneMap/WebODM
Fix OAM plugin bug, improve buttons CSS
rodzic
d9e46e252f
commit
b10fc806d5
|
@ -89,6 +89,7 @@
|
||||||
.action-buttons{
|
.action-buttons{
|
||||||
button{
|
button{
|
||||||
margin-right: 4px;
|
margin-right: 4px;
|
||||||
|
margin-top: 4px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-group{
|
.btn-group{
|
||||||
|
|
|
@ -59,38 +59,41 @@ class Info(TaskView):
|
||||||
|
|
||||||
# Populate fields from first image in task
|
# Populate fields from first image in task
|
||||||
img = ImageUpload.objects.filter(task=task).exclude(image__iendswith='.txt').first()
|
img = ImageUpload.objects.filter(task=task).exclude(image__iendswith='.txt').first()
|
||||||
img_path = os.path.join(settings.MEDIA_ROOT, img.path())
|
if img is not None:
|
||||||
im = Image.open(img_path)
|
img_path = os.path.join(settings.MEDIA_ROOT, img.path())
|
||||||
|
im = Image.open(img_path)
|
||||||
|
|
||||||
# TODO: for better data we could look over all images
|
# TODO: for better data we could look over all images
|
||||||
# and find actual end and start time
|
# and find actual end and start time
|
||||||
# Here we're picking an image at random and assuming a one hour flight
|
# Here we're picking an image at random and assuming a one hour flight
|
||||||
if not 'sensor' in task_info:
|
if not 'sensor' in task_info:
|
||||||
task_info['endDate'] = datetime.utcnow().timestamp() * 1000
|
task_info['endDate'] = datetime.utcnow().timestamp() * 1000
|
||||||
task_info['sensor'] = ''
|
task_info['sensor'] = ''
|
||||||
task_info['title'] = task.name
|
task_info['title'] = task.name
|
||||||
task_info['provider'] = get_site_settings().organization_name
|
task_info['provider'] = get_site_settings().organization_name
|
||||||
|
|
||||||
if 'exif' in im.info:
|
if 'exif' in im.info:
|
||||||
exif_dict = piexif.load(im.info['exif'])
|
exif_dict = piexif.load(im.info['exif'])
|
||||||
if 'Exif' in exif_dict:
|
if 'Exif' in exif_dict:
|
||||||
if piexif.ExifIFD.DateTimeOriginal in exif_dict['Exif']:
|
if piexif.ExifIFD.DateTimeOriginal in exif_dict['Exif']:
|
||||||
try:
|
try:
|
||||||
parsed_date = datetime.strptime(exif_dict['Exif'][piexif.ExifIFD.DateTimeOriginal].decode('ascii'),
|
parsed_date = datetime.strptime(exif_dict['Exif'][piexif.ExifIFD.DateTimeOriginal].decode('ascii'),
|
||||||
'%Y:%m:%d %H:%M:%S')
|
'%Y:%m:%d %H:%M:%S')
|
||||||
task_info['endDate'] = parsed_date.timestamp() * 1000
|
task_info['endDate'] = parsed_date.timestamp() * 1000
|
||||||
except ValueError:
|
except ValueError:
|
||||||
# Ignore date field if we can't parse it
|
# Ignore date field if we can't parse it
|
||||||
pass
|
pass
|
||||||
if '0th' in exif_dict:
|
if '0th' in exif_dict:
|
||||||
if piexif.ImageIFD.Make in exif_dict['0th']:
|
if piexif.ImageIFD.Make in exif_dict['0th']:
|
||||||
task_info['sensor'] = exif_dict['0th'][piexif.ImageIFD.Make].decode('ascii').strip(' \t\r\n\0')
|
task_info['sensor'] = exif_dict['0th'][piexif.ImageIFD.Make].decode('ascii').strip(' \t\r\n\0')
|
||||||
|
|
||||||
if piexif.ImageIFD.Model in exif_dict['0th']:
|
if piexif.ImageIFD.Model in exif_dict['0th']:
|
||||||
task_info['sensor'] = (task_info['sensor'] + " " + exif_dict['0th'][piexif.ImageIFD.Model].decode('ascii')).strip(' \t\r\n\0')
|
task_info['sensor'] = (task_info['sensor'] + " " + exif_dict['0th'][piexif.ImageIFD.Model].decode('ascii')).strip(' \t\r\n\0')
|
||||||
|
|
||||||
task_info['startDate'] = task_info['endDate'] - 60 * 60 * 1000
|
task_info['startDate'] = task_info['endDate'] - 60 * 60 * 1000
|
||||||
set_task_info(task.id, task_info)
|
set_task_info(task.id, task_info)
|
||||||
|
else:
|
||||||
|
task_info['noImages'] = True
|
||||||
|
|
||||||
return Response(task_info, status=status.HTTP_200_OK)
|
return Response(task_info, status=status.HTTP_200_OK)
|
||||||
|
|
||||||
|
|
|
@ -109,6 +109,7 @@ export default class ShareButton extends React.Component{
|
||||||
|
|
||||||
render(){
|
render(){
|
||||||
const { loading, taskInfo, error } = this.state;
|
const { loading, taskInfo, error } = this.state;
|
||||||
|
if (taskInfo.noImages) return (<div/>);
|
||||||
|
|
||||||
const getButtonIcon = () => {
|
const getButtonIcon = () => {
|
||||||
if (loading || taskInfo.sharing) return "fa fa-circle-notch fa-spin fa-fw";
|
if (loading || taskInfo.sharing) return "fa fa-circle-notch fa-spin fa-fw";
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "WebODM",
|
"name": "WebODM",
|
||||||
"version": "1.9.11",
|
"version": "1.9.12",
|
||||||
"description": "User-friendly, extendable application and API for processing aerial imagery.",
|
"description": "User-friendly, extendable application and API for processing aerial imagery.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
Ładowanie…
Reference in New Issue