@@ -849,16 +849,17 @@ def __init__(self, fps=30, codec=None, bitrate=None, extra_args=None,
849
849
self .default_mode = 'loop'
850
850
_log .warning ("unrecognized default_mode: using 'loop'" )
851
851
852
- self ._saved_frames = []
853
- self ._total_bytes = 0
854
- self ._hit_limit = False
855
852
super ().__init__ (fps , codec , bitrate , extra_args , metadata )
856
853
857
854
def setup (self , fig , outfile , dpi , frame_dir = None ):
858
855
root , ext = os .path .splitext (outfile )
859
856
if ext not in ['.html' , '.htm' ]:
860
857
raise ValueError ("outfile must be *.htm or *.html" )
861
858
859
+ self ._saved_frames = []
860
+ self ._total_bytes = 0
861
+ self ._hit_limit = False
862
+
862
863
if not self .embed_frames :
863
864
if frame_dir is None :
864
865
frame_dir = root + '_frames'
@@ -875,7 +876,6 @@ def grab_frame(self, **savefig_kwargs):
875
876
# Just stop processing if we hit the limit
876
877
if self ._hit_limit :
877
878
return
878
- suffix = '.' + self .frame_format
879
879
f = BytesIO ()
880
880
self .fig .savefig (f , format = self .frame_format ,
881
881
dpi = self .dpi , ** savefig_kwargs )
@@ -909,11 +909,12 @@ def communicate(self):
909
909
if self .embed_frames :
910
910
fill_frames = _embedded_frames (self ._saved_frames ,
911
911
self .frame_format )
912
+ Nframes = len (self ._saved_frames )
912
913
else :
913
914
# temp names is filled by FileMovieWriter
914
915
fill_frames = _included_frames (self ._temp_names ,
915
916
self .frame_format )
916
-
917
+ Nframes = len ( self . _temp_names )
917
918
mode_dict = dict (once_checked = '' ,
918
919
loop_checked = '' ,
919
920
reflect_checked = '' )
@@ -924,7 +925,7 @@ def communicate(self):
924
925
with open (self .outfile , 'w' ) as of :
925
926
of .write (JS_INCLUDE )
926
927
of .write (DISPLAY_TEMPLATE .format (id = uuid .uuid4 ().hex ,
927
- Nframes = len ( self . _temp_names ) ,
928
+ Nframes = Nframes ,
928
929
fill_frames = fill_frames ,
929
930
interval = interval ,
930
931
** mode_dict ))
0 commit comments