embed images
This commit is contained in:
@@ -36,7 +36,7 @@ class OutputManager:
|
||||
|
||||
def _get_or_create_output_dir(self) -> Path:
|
||||
"""
|
||||
Get existing output directory or create a new timestamped one.
|
||||
Get existing output directory or create a new one with incremental number.
|
||||
|
||||
Returns:
|
||||
Path to output directory
|
||||
@@ -54,9 +54,29 @@ class OutputManager:
|
||||
logger.info(f"Found existing output: {existing_dirs[0].name}")
|
||||
return existing_dirs[0]
|
||||
|
||||
# Create new timestamped directory
|
||||
timestamp = datetime.now().strftime("%Y%m%d_%H%M%S")
|
||||
dir_name = f"{timestamp}-{video_name}"
|
||||
# Create new directory with date + incremental number
|
||||
date_str = datetime.now().strftime("%Y%m%d")
|
||||
|
||||
# Find existing runs for today
|
||||
if self.base_output_dir.exists():
|
||||
existing_today = [
|
||||
d for d in self.base_output_dir.iterdir()
|
||||
if d.is_dir() and d.name.startswith(date_str) and d.name.endswith(f"-{video_name}")
|
||||
]
|
||||
|
||||
# Extract run numbers and find max
|
||||
run_numbers = []
|
||||
for d in existing_today:
|
||||
# Format: YYYYMMDD-NNN-videoname
|
||||
parts = d.name.split('-')
|
||||
if len(parts) >= 2 and parts[1].isdigit():
|
||||
run_numbers.append(int(parts[1]))
|
||||
|
||||
next_run = max(run_numbers) + 1 if run_numbers else 1
|
||||
else:
|
||||
next_run = 1
|
||||
|
||||
dir_name = f"{date_str}-{next_run:03d}-{video_name}"
|
||||
output_dir = self.base_output_dir / dir_name
|
||||
output_dir.mkdir(parents=True, exist_ok=True)
|
||||
logger.info(f"Created new output directory: {dir_name}")
|
||||
|
||||
Reference in New Issue
Block a user