feat: ensure consistent filename IDs across script steps
This commit is contained in:
@@ -286,12 +286,15 @@ validate_inputs() {
|
|||||||
# OUTPUT FILENAME GENERATION
|
# OUTPUT FILENAME GENERATION
|
||||||
# ============================================================================
|
# ============================================================================
|
||||||
|
|
||||||
|
_GENERATED_TIMESTAMP=""
|
||||||
|
|
||||||
generate_output_filename() {
|
generate_output_filename() {
|
||||||
local suffix="${1:-}"
|
local suffix="${1:-}"
|
||||||
local timestamp
|
if [[ -z "$_GENERATED_TIMESTAMP" ]]; then
|
||||||
timestamp=$(date +%Y%m%d_%H%M%S)
|
_GENERATED_TIMESTAMP=$(date +%Y%m%d_%H%M%S)
|
||||||
|
fi
|
||||||
local seed_part="${SEED:-0}"
|
local seed_part="${SEED:-0}"
|
||||||
local base="img_${MODEL}_${timestamp}_${seed_part}"
|
local base="img_${MODEL}_${_GENERATED_TIMESTAMP}_${seed_part}"
|
||||||
|
|
||||||
if [[ -n "$suffix" ]]; then
|
if [[ -n "$suffix" ]]; then
|
||||||
echo "${base}_${suffix}.png"
|
echo "${base}_${suffix}.png"
|
||||||
@@ -970,6 +973,9 @@ main() {
|
|||||||
# Validate inputs
|
# Validate inputs
|
||||||
validate_inputs
|
validate_inputs
|
||||||
|
|
||||||
|
# Initialize timestamp for consistent naming across subshells
|
||||||
|
_GENERATED_TIMESTAMP=$(date +%Y%m%d_%H%M%S)
|
||||||
|
|
||||||
# Banner
|
# Banner
|
||||||
print_banner "${PALETTE} Pivoine Image Generator ${SPARKLES}"
|
print_banner "${PALETTE} Pivoine Image Generator ${SPARKLES}"
|
||||||
|
|
||||||
@@ -1043,9 +1049,14 @@ main() {
|
|||||||
local ext="${OUTPUT_FILE##*.}"
|
local ext="${OUTPUT_FILE##*.}"
|
||||||
local base="${OUTPUT_FILE%.*}"
|
local base="${OUTPUT_FILE%.*}"
|
||||||
upscale_path="${base}_upscaled.${ext}"
|
upscale_path="${base}_upscaled.${ext}"
|
||||||
|
else
|
||||||
|
# Include faceswap in name if it was performed
|
||||||
|
if [[ -n "${faceswap_path:-}" && -f "${faceswap_path}" ]]; then
|
||||||
|
upscale_path="$(generate_output_filename "faceswap_upscaled")"
|
||||||
else
|
else
|
||||||
upscale_path="$(generate_output_filename "upscaled")"
|
upscale_path="$(generate_output_filename "upscaled")"
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
realesrgan_upscale "$final_input" upscale_path || exit 1
|
realesrgan_upscale "$final_input" upscale_path || exit 1
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user