mirror of
https://github.com/facefusion/facefusion.git
synced 2026-09-15 12:05:27 +02:00
* convert content store * add local_id variables * add local_id variables * fix misconcept of clear() in stores, pass session id to threads
53 lines
1.6 KiB
Python
53 lines
1.6 KiB
Python
import os
|
|
import tempfile
|
|
|
|
from facefusion.filesystem import are_images, create_directory, is_directory, is_file, remove_directory, resolve_file_paths
|
|
from facefusion.session_context import resolve_local_id
|
|
from facefusion.types import JobStatus
|
|
|
|
|
|
def is_test_job_file(file_path : str, job_status : JobStatus) -> bool:
|
|
return is_file(get_test_job_file(file_path, job_status))
|
|
|
|
|
|
def get_test_job_file(file_path : str, job_status : JobStatus) -> str:
|
|
local_id = resolve_local_id()
|
|
jobs_path = os.path.join(get_test_jobs_directory(), local_id)
|
|
|
|
return os.path.join(jobs_path, job_status, file_path)
|
|
|
|
|
|
def get_test_jobs_directory() -> str:
|
|
return os.path.join(tempfile.gettempdir(), 'facefusion-test-jobs')
|
|
|
|
|
|
def get_test_example_file(file_path : str) -> str:
|
|
return os.path.join(get_test_examples_directory(), file_path)
|
|
|
|
|
|
def get_test_examples_directory() -> str:
|
|
return os.path.join(tempfile.gettempdir(), 'facefusion-test-examples')
|
|
|
|
|
|
def is_test_output_file(file_path : str) -> bool:
|
|
return is_file(get_test_output_path(file_path))
|
|
|
|
|
|
def is_test_output_sequence(directory_path : str) -> bool:
|
|
return are_images(resolve_file_paths(directory_path))
|
|
|
|
|
|
def get_test_output_path(file_path : str) -> str:
|
|
return os.path.join(get_test_outputs_directory(), file_path)
|
|
|
|
|
|
def get_test_outputs_directory() -> str:
|
|
return os.path.join(tempfile.gettempdir(), 'facefusion-test-outputs')
|
|
|
|
|
|
def prepare_test_output_directory() -> bool:
|
|
test_outputs_directory = get_test_outputs_directory()
|
|
remove_directory(test_outputs_directory)
|
|
create_directory(test_outputs_directory)
|
|
return is_directory(test_outputs_directory)
|