Parcourir la source

Automatically generate tiles when importing a panorama manually

Baptiste Jonglez il y a 9 ans
Parent
commit
95523b995d
2 fichiers modifiés avec 8 ajouts et 5 suppressions
  1. 6 5
      UPGRADE.md
  2. 2 0
      panorama/management/commands/import_single_pano.py

+ 6 - 5
UPGRADE.md

@@ -94,11 +94,12 @@ panorama.  Usage:
 
 The PHP script will convert the parameters file to a JSON representation,
 which is then passed to a Django command (along with the actual panorama
-image) for importing into the databse.  A copy of the image file will be
-put into the `media/pano` directory, meaning you can remove the original
-image file once you ensured that the import process went smoothly.
+image) for importing into the database.  The Django command then launches
+the tile generation process on the new panorama.
+
+A copy of the image file will be put into the `media/pano` directory,
+meaning you can remove the original image file once you ensured that
+the import process went smoothly.
 
 For convenience, a simple shell script that does exactly the above is provided:
 `upgrade/import_single_pano.sh`.
-
-Then, you need to regenerate tiles for the imported panorama (see above).

+ 2 - 0
panorama/management/commands/import_single_pano.py

@@ -48,6 +48,8 @@ class Command(BaseCommand):
             p.image.save(os.path.basename(args[0]), File(f), save=False)
             self.stdout.write("Saving panorama to database...")
             p.save()
+        self.stdout.write("Launching tile generation...")
+        p.generate_tiles()
         self.stdout.write("Saving references to database...")
         for refname, xy in data["reference"].items():
             xy = xy.split(",")