safety, glbs now have no sanitizing of file names; png & webP conversions work
This commit is contained in:
parent
358dd3eac0
commit
8181c9b2d4
11 changed files with 267 additions and 878 deletions
|
|
@ -2,12 +2,34 @@
|
|||
# 20260228 ChatGPT
|
||||
# $Header$
|
||||
#
|
||||
# This script creates links from the staging directory to
|
||||
# the glbs sibling directory. The staging directory is where the glbs are staged for rendering.
|
||||
# The glbs sibling directory is where the PNG & webP batch renderer expects to find the glbs. The files names
|
||||
# are sanitized to be filesystem safe and to avoid collisions by adding the path components
|
||||
# delimited by double underscores.
|
||||
|
||||
# If a collision is detected, a numeric suffix is added to disambiguate.
|
||||
# Consequently, the name of the link is not the same as the original glb, but contains the original path
|
||||
# components in a sanitized form. This allows the batch renderer to process all the glbs without worrying
|
||||
# about name collisions, while still retaining some traceability to the original files.
|
||||
#
|
||||
# For example, if the staging directory contains:
|
||||
# /home/jlpoole/work/Voron/test1/Klicky-Probe/Printers/Voron/v1.8_v2.4_Legacy_Trident/v1.8_v2.4_Legacy_Trident_STL/Dock_mount_fixed_v2.glb
|
||||
# then this script will create the very long file name:
|
||||
# glbs/Klicky-Probe__Printers__Voron__...__Dock_mount_fixed_v2.stl.glb
|
||||
#
|
||||
# Note: the brackets in a file name, e.g. "[a]" are preserved.
|
||||
# Another example, if the staging directory contains:
|
||||
# /home/jlpoole/work/Voron/test1/Voron/Skirts/[a]_belt_guard_a_x2.stl.glb
|
||||
# then this script will create the file name:
|
||||
# 'Voron-2__STLs__Skirts__[a]_belt_guard_a_x2.stl.glb'
|
||||
#
|
||||
# Copy/paste:
|
||||
# cd ~/work/Voron/renderlab/web/batch_glb_png
|
||||
# chmod +x link_glbs.sh
|
||||
# ./link_glbs.sh /home/jlpoole/work/Voron/test1
|
||||
#
|
||||
# This creates symlinks under ./glbs/ pointing to every *.glb under ROOT.
|
||||
# This creates symlinks under ./glbs/ pointing to every *.glb under the staging directory.
|
||||
|
||||
set -eu
|
||||
|
||||
|
|
@ -39,8 +61,9 @@ sanitize() {
|
|||
# shellcheck disable=SC2001
|
||||
echo "$1" \
|
||||
| sed 's|^/||' \
|
||||
| sed 's|/|__|g' \
|
||||
| sed 's|[^A-Za-z0-9._-]|_|g'
|
||||
| sed 's|/|__|g'
|
||||
#| sed 's|/|__|g' \
|
||||
#| sed 's|[^A-Za-z0-9._-]|_|g'
|
||||
}
|
||||
|
||||
count=0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue