Skip to content

Commit

Permalink
Fixed .gif related issues (#2494)
Browse files Browse the repository at this point in the history
* fix-order of operations

* Use ffplay to preview gifs

* typo

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
ad-chaos and pre-commit-ci[bot] authored Jan 26, 2022
1 parent 35e1a42 commit df8cefe
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
9 changes: 7 additions & 2 deletions manim/scene/scene_file_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,12 @@ def init_output_directories(self, scene_name):
if is_gif_format():
self.gif_file_path = os.path.join(
movie_dir,
add_extension_if_not_present(self.output_name, GIF_FILE_EXTENSION),
add_version_before_extension(
add_extension_if_not_present(
self.output_name,
GIF_FILE_EXTENSION,
),
),
)

self.partial_movie_directory = guarantee_existence(
Expand Down Expand Up @@ -606,7 +611,7 @@ def combine_to_movie(self):
# determine output path
movie_file_path = self.movie_file_path
if is_gif_format() and not config["output_file"]:
movie_file_path = str(add_version_before_extension(self.gif_file_path))
movie_file_path = self.gif_file_path
logger.info("Combining to Movie file.")
self.combine_files(
partial_movie_files,
Expand Down
5 changes: 4 additions & 1 deletion manim/utils/file_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,10 @@ def open_file(file_path, in_browser=False):
commands = ["cygstart"]
file_path = file_path if not in_browser else os.path.dirname(file_path)
elif current_os == "Darwin":
commands = ["open"] if not in_browser else ["open", "-R"]
if is_gif_format():
commands = ["ffplay", "-loglevel", config["ffmpeg_loglevel"].lower()]
else:
commands = ["open"] if not in_browser else ["open", "-R"]
else:
raise OSError("Unable to identify your operating system...")
commands.append(file_path)
Expand Down

0 comments on commit df8cefe

Please sign in to comment.