def build_playlist_movie_file(playlist): """ Build a movie for all files for a given playlist into the temporary folder. """ tmp_file_paths = retrieve_playlist_tmp_files(playlist) movie_file_path = get_playlist_movie_file_path(playlist) project = projects_service.get_project(playlist["project_id"]) fps = "24.00" if project["fps"] is not None: fps = "%.2f" % float(project["fps"].replace(",", ".")) movie_utils.build_playlist_movie(tmp_file_paths, movie_file_path, fps) return movie_file_path
def build_playlist_movie_file(playlist, app=None): """ Build a movie for all files for a given playlist into the temporary folder. """ job = start_build_job(playlist) project = projects_service.get_project(playlist["project_id"]) tmp_file_paths = retrieve_playlist_tmp_files(playlist, only_movies=True) movie_file_path = get_playlist_movie_file_path(playlist, job) (width, height) = shots_service.get_preview_dimensions(project) fps = shots_service.get_preview_fps(project) result = movie_utils.build_playlist_movie(tmp_file_paths, movie_file_path, width, height, fps) if result["success"] == True: if os.path.exists(movie_file_path): file_store.add_movie("playlists", job["id"], movie_file_path) else: if app is not None: current_app.logger.error("No playlist was created") result["success"] = False result["message"] = "No playlist was created" elif app is not None: current_app.logger.error(result["message"]) end_build_job(playlist, job, result) return job
def test_movie_utils(self): movie_file_path = 'tests/test_data/testresult.mp4' if os.path.exists(movie_file_path): os.unlink(movie_file_path) tmp_file_paths = [['tests/test_data/with_audio.mp4', 'with_audio'], ['tests/test_data/without_audio.mp4', 'without_audio']] result = movie_utils.build_playlist_movie(tmp_file_paths, movie_file_path) self.assertTrue(result['success']) self.assertTrue(os.path.exists(movie_file_path))
def build_playlist_movie_file(playlist): """ Build a movie for all files for a given playlist into the temporary folder. """ job = start_build_job(playlist) project = projects_service.get_project(playlist["project_id"]) tmp_file_paths = retrieve_playlist_tmp_files(playlist) movie_file_path = get_playlist_movie_file_path(playlist, job) (width, height) = shots_service.get_preview_dimensions(project) fps = shots_service.get_preview_fps(project) movie_utils.build_playlist_movie( tmp_file_paths, movie_file_path, width, height, fps ) file_store.add_movie("playlists", job["id"], movie_file_path) end_build_job(playlist, job) return job