def save_movie_preview(self, instance_id, uploaded_file): """ Get uploaded movie, normalize it (720p) then build thumbnails then save everything in the file storage. """ tmp_folder = current_app.config["TMP_DIR"] fps = "24.00" uploaded_movie_path = movie_utils.save_file( tmp_folder, instance_id, uploaded_file ) project = files_service.get_project_from_preview_file(instance_id) if project["fps"] is not None: fps = "%.2f" % float(project["fps"].replace(",", ".")) normalized_movie_path = movie_utils.normalize_movie( uploaded_movie_path, fps=fps ) file_store.add_movie("previews", instance_id, normalized_movie_path) original_tmp_path = movie_utils.generate_thumbnail( normalized_movie_path ) os.remove(uploaded_movie_path) os.remove(normalized_movie_path) return self.save_variants(original_tmp_path, instance_id)
def save_movie_preview(self, instance_id, uploaded_file): """ Get uploaded movie, normalize it (720p) then build thumbnails then save everything in the file storage. """ tmp_folder = current_app.config["TMP_DIR"] uploaded_movie_path = movie_utils.save_file(tmp_folder, instance_id, uploaded_file) normalized_movie_path = movie_utils.normalize_movie( uploaded_movie_path) file_store.add_movie("previews", instance_id, normalized_movie_path) original_tmp_path = movie_utils.generate_thumbnail( normalized_movie_path) os.remove(uploaded_movie_path) os.remove(normalized_movie_path) return self.save_variants(original_tmp_path, instance_id)
def save_movie_preview(self, preview_file_id, uploaded_file): """ Get uploaded movie, normalize it then build thumbnails then save everything in the file storage. """ no_job = self.get_no_job() tmp_folder = current_app.config["TMP_DIR"] uploaded_movie_path = movie_utils.save_file(tmp_folder, preview_file_id, uploaded_file) if config.ENABLE_JOB_QUEUE and not no_job: queue_store.job_queue.enqueue( preview_files_service.prepare_and_store_movie, args=(preview_file_id, uploaded_movie_path), job_timeout=600, ) else: preview_files_service.prepare_and_store_movie( preview_file_id, uploaded_movie_path) return preview_file_id
def save_movie_preview(self, instance_id, uploaded_file): """ Get uploaded movie, normalize it then build thumbnails then save everything in the file storage. """ tmp_folder = current_app.config["TMP_DIR"] uploaded_movie_path = movie_utils.save_file(tmp_folder, instance_id, uploaded_file) project = files_service.get_project_from_preview_file(instance_id) fps = shots_service.get_preview_fps(project) (width, height) = shots_service.get_preview_dimensions(project) normalized_movie_path = movie_utils.normalize_movie( uploaded_movie_path, fps=fps, width=width, height=height) file_store.add_movie("previews", instance_id, normalized_movie_path) original_tmp_path = movie_utils.generate_thumbnail( normalized_movie_path) os.remove(uploaded_movie_path) os.remove(normalized_movie_path) return self.save_variants(original_tmp_path, instance_id)