File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,24 @@ def construct(self):
3232 self .pause () # Waits user to press continue to go to the next slide
3333
3434
35+ class TestFileTooLong (Slide ):
36+ """This is used to check against solution for issue #123."""
37+
38+ def construct (self ):
39+ import random
40+
41+ circle = Circle (radius = 3 , color = BLUE )
42+ dot = Dot ()
43+ self .play (GrowFromCenter (circle ), run_time = 0.1 )
44+
45+ for _ in range (30 ):
46+ direction = (random .random () - 0.5 ) * LEFT + (random .random () - 0.5 ) * UP
47+ self .play (dot .animate .move_to (direction ), run_time = 0.1 )
48+ self .play (dot .animate .move_to (ORIGIN ), run_time = 0.1 )
49+
50+ self .pause ()
51+
52+
3553class ConvertExample (Slide ):
3654 """WARNING: this example does not seem to work with ManimGL."""
3755
Original file line number Diff line number Diff line change 1+ import hashlib
12import os
23import shutil
34import subprocess
@@ -15,11 +16,18 @@ def merge_basenames(files: List[str]) -> str:
1516 """
1617 Merge multiple filenames by concatenating basenames.
1718 """
19+ logger .info (f"Generating a new filename for animations: { files } " )
1820
1921 dirname = os .path .dirname (files [0 ])
2022 _ , ext = os .path .splitext (files [0 ])
2123
22- basename = "_" .join (os .path .splitext (os .path .basename (file ))[0 ] for file in files )
24+ basenames = (os .path .splitext (os .path .basename (file ))[0 ] for file in files )
25+
26+ basenames_str = "," .join (f"{ len (b )} :{ b } " for b in basenames )
27+
28+ # We use hashes to prevent too-long filenames, see issue #123:
29+ # https://github.com/jeertmans/manim-slides/issues/123
30+ basename = hashlib .sha256 (basenames_str .encode ()).hexdigest ()
2331
2432 return os .path .join (dirname , basename + ext )
2533
You can’t perform that action at this time.
0 commit comments