jhj0517
commited on
Commit
·
84ca156
1
Parent(s):
a7b7a6b
Make it normpath
Browse files- modules/utils/paths.py +1 -0
- modules/utils/video_helper.py +3 -4
modules/utils/paths.py
CHANGED
@@ -42,6 +42,7 @@ def get_auto_incremental_file_path(dir_path: str, extension: str, prefix: str =
|
|
42 |
filename = f"{counter:05d}.{extension}"
|
43 |
full_path = os.path.join(dir_path, filename)
|
44 |
if not os.path.exists(full_path):
|
|
|
45 |
return full_path
|
46 |
counter += 1
|
47 |
|
|
|
42 |
filename = f"{counter:05d}.{extension}"
|
43 |
full_path = os.path.join(dir_path, filename)
|
44 |
if not os.path.exists(full_path):
|
45 |
+
full_path = os.path.normpath(full_path)
|
46 |
return full_path
|
47 |
counter += 1
|
48 |
|
modules/utils/video_helper.py
CHANGED
@@ -161,6 +161,7 @@ def create_video_from_frames(
|
|
161 |
"""
|
162 |
if not os.path.exists(frames_dir):
|
163 |
raise "frames_dir does not exist"
|
|
|
164 |
|
165 |
if output_dir is None:
|
166 |
output_dir = OUTPUTS_VIDEOS_DIR
|
@@ -186,12 +187,10 @@ def create_video_from_frames(
|
|
186 |
pix_format = None
|
187 |
vid_codec, audio_codec = "gif", None
|
188 |
|
189 |
-
|
190 |
-
filename = f"{num_files:05d}{output_mime_type}"
|
191 |
-
output_path = os.path.join(output_dir, filename)
|
192 |
|
193 |
if sound_path is None:
|
194 |
-
temp_sound = os.path.join(TEMP_VIDEO_FRAMES_DIR, "sound.mp3")
|
195 |
if os.path.exists(temp_sound):
|
196 |
sound_path = temp_sound
|
197 |
|
|
|
161 |
"""
|
162 |
if not os.path.exists(frames_dir):
|
163 |
raise "frames_dir does not exist"
|
164 |
+
frames_dir = os.path.normpath(frames_dir)
|
165 |
|
166 |
if output_dir is None:
|
167 |
output_dir = OUTPUTS_VIDEOS_DIR
|
|
|
187 |
pix_format = None
|
188 |
vid_codec, audio_codec = "gif", None
|
189 |
|
190 |
+
output_path = get_auto_incremental_file_path(output_dir, output_mime_type.replace(".", ""))
|
|
|
|
|
191 |
|
192 |
if sound_path is None:
|
193 |
+
temp_sound = os.path.normpath(os.path.join(TEMP_VIDEO_FRAMES_DIR, "sound.mp3"))
|
194 |
if os.path.exists(temp_sound):
|
195 |
sound_path = temp_sound
|
196 |
|