From 48a068512d38686f11c7e2fdadb98313ba15b993 Mon Sep 17 00:00:00 2001 From: henryruhs Date: Sun, 20 Aug 2023 19:48:52 +0200 Subject: [PATCH] Use /tmp/facefusion --- facefusion/core.py | 2 +- facefusion/utilities.py | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/facefusion/core.py b/facefusion/core.py index 8a6edc6..24dcce7 100755 --- a/facefusion/core.py +++ b/facefusion/core.py @@ -190,7 +190,7 @@ def process_video() -> None: else: update_status(wording.get('restoring_audio_issues')) restore_audio(facefusion.globals.target_path, facefusion.globals.output_path) - # clean temp + # clear temp update_status(wording.get('clearing_temp')) clear_temp(facefusion.globals.target_path) # validate video diff --git a/facefusion/utilities.py b/facefusion/utilities.py index f8a1c14..41d2d32 100644 --- a/facefusion/utilities.py +++ b/facefusion/utilities.py @@ -16,8 +16,8 @@ from tqdm import tqdm import facefusion.globals from facefusion import wording -TEMP_DIRECTORY = tempfile.mkdtemp(prefix = 'facefusion') -TEMP_VIDEO_FILE = 'temp.mp4' +TEMP_DIRECTORY_PATH = os.path.join(tempfile.gettempdir(), 'facefusion') +TEMP_OUTPUT_NAME = 'temp.mp4' # monkey patch ssl if platform.system().lower() == 'darwin': @@ -99,13 +99,12 @@ def get_temp_frame_paths(target_path : str) -> List[str]: def get_temp_directory_path(target_path : str) -> str: target_name, _ = os.path.splitext(os.path.basename(target_path)) - target_directory_path = os.path.dirname(target_path) - return os.path.join(target_directory_path, TEMP_DIRECTORY, target_name) + return os.path.join(TEMP_DIRECTORY_PATH, target_name) def get_temp_output_path(target_path : str) -> str: temp_directory_path = get_temp_directory_path(target_path) - return os.path.join(temp_directory_path, TEMP_VIDEO_FILE) + return os.path.join(temp_directory_path, TEMP_OUTPUT_NAME) def normalize_output_path(source_path : str, target_path : str, output_path : str) -> Optional[str]: