Video-Face-Swap / roop /globals.py
Jonny001's picture
Update roop/globals.py
e44b2d4 verified
source_path = None
target_path = None
output_path = None
frame_processors = []
keep_fps = True
keep_audio = True
video_encoder = 'libx264'
video_quality = 50
log_level = 'error'
def set_global_paths(src: str, tgt: str, out: str) -> None:
"""
Set global paths for source, target, and output.
Args:
src (str): Source path.
tgt (str): Target path.
out (str): Output path.
"""
global source_path, target_path, output_path
source_path = src
target_path = tgt
output_path = out
def set_processing_options(encoder: str, quality: int, log: str) -> None:
"""
Set options for video processing.
Args:
encoder (str): Video encoder.
quality (int): Video quality.
log (str): Log level.
"""
global video_encoder, video_quality, log_level
video_encoder = encoder
video_quality = quality
log_level = log
def set_frame_processors(processors: list) -> None:
"""
Set the frame processors.
Args:
processors (list): List of frame processors.
"""
global frame_processors
frame_processors = processors
def set_keep_options(fps: bool, audio: bool) -> None:
"""
Set options to keep FPS and audio.
Args:
fps (bool): Whether to keep FPS.
audio (bool): Whether to keep audio.
"""
global keep_fps, keep_audio
keep_fps = fps
keep_audio = audio
def clean_temp(target_path: str) -> None:
"""
Cleans up temporary files after processing.
Args:
target_path (str): Path of the target file to be cleaned up.
"""
if os.path.exists(target_path):
os.remove(target_path)
print(f"Cleaned up temporary file: {target_path}")
else:
print(f"No temporary file found at: {target_path}")
def some_function():
global source_path, target_path, output_path, frame_processors, keep_fps, keep_audio
print(f"Source Path: {source_path}")
print(f"Target Path: {target_path}")
print(f"Output Path: {output_path}")
print(f"Frame Processors: {frame_processors}")
print(f"Keep FPS: {keep_fps}")
print(f"Keep Audio: {keep_audio}")