add convenience script
This commit is contained in:
47
process.sh
Normal file
47
process.sh
Normal file
@@ -0,0 +1,47 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -euox pipefail
|
||||
|
||||
# Define Paths
|
||||
SOURCE_ROOT="./cars"
|
||||
DEST_ROOT="./server-data/content/cars"
|
||||
mkdir -p "$DEST_ROOT"
|
||||
|
||||
echo "Searching for archives in $SOURCE_ROOT..."
|
||||
|
||||
tree "$SOURCE_ROOT" # DEBUG
|
||||
|
||||
# Find all archives recursively (zip, 7z, rar)
|
||||
find "$SOURCE_ROOT" -type f \( -name "*.zip" -o -name "*.7z" -o -name "*.rar" \) | while read archive; do
|
||||
|
||||
# Get the filename without extension
|
||||
filename=$(basename -- "$archive")
|
||||
car_name="${filename%.*}"
|
||||
|
||||
echo "--------------------------------------"
|
||||
echo "Processing: $car_name"
|
||||
|
||||
# Create a temp directory for extraction
|
||||
temp_dir=$(mktemp -d)
|
||||
|
||||
# Extract contents
|
||||
7z x "$archive" -o"$temp_dir" -y > /dev/null
|
||||
|
||||
echo "Extracted to: $temp_dir"
|
||||
tree "$temp_dir" # DEBUG
|
||||
|
||||
# FILTERING LOGIC
|
||||
find "$temp_dir" -type f -not -name "skins/*/livery.png" \
|
||||
-not -name "skins/*/preview.jpeg" \
|
||||
-not -name "skins/*/ui_skin.json" \
|
||||
-not -name "ui/badge.png" \
|
||||
-not -name "ui/ui_car.json" \
|
||||
-not -name "data.acd" \
|
||||
-not -name "physics/standard/data.acd" \
|
||||
-not -name "physics/csp/data.acd" \
|
||||
-delete
|
||||
|
||||
echo "After filtering:"
|
||||
tree "$temp_dir"
|
||||
|
||||
done
|
||||
Reference in New Issue
Block a user