Browse Source

Fix output image path for pano generation

Baptiste Jonglez 10 years ago
parent
commit
d11c3a1696
1 changed files with 5 additions and 4 deletions
  1. 5 4
      panorama/tasks.py

+ 5 - 4
panorama/tasks.py

@@ -2,6 +2,7 @@
 from __future__ import unicode_literals, division, print_function, absolute_import
 
 import os
+import shutil
 import subprocess
 import tempfile
 
@@ -50,13 +51,13 @@ def autocrop(input_pto, output_pto):
 
 @shared_task
 def generate_pano(input_pto, dirname, output_image):
-    project_name = output_image[output_image.rfind(".tif")]
-    output_name = os.path.join(dirname, project_name)
+    project_name = os.path.join(dirname, "pano")
     # hugin_executor is only available since hugin 2015.0
-    # return subprocess.call(["hugin_executor", "--prefix", output_name, input_pto])
+    # return subprocess.call(["hugin_executor", "--prefix", project_name, input_pto])
     makefile_name = os.path.join(dirname, "celery_pano.mk")
     subprocess.call(["pto2mk", "-o", makefile_name, "-p", project_name, input_pto])
-    return subprocess.call(["make", "-f", makefile_name])
+    subprocess.call(["make", "-f", makefile_name])
+    shutil.move(project_name + ".tif", output_image)
 
 @shared_task
 def panorama_pipeline(images, output_image):