Insert the cleaned title into the sidecar JSON.

This commit is contained in:
Aaron 2025-10-21 19:45:48 -04:00
parent d5bfda08c2
commit 08ffabe0d6

View File

@ -0,0 +1,20 @@
#!/bin/bash
for f in *.info.json; do
[ -f "$f" ] || continue
# Extract title: remove .info.json and remove ID in brackets at the end
title="${f%.info.json}" # Remove extension
title="${title% \[*\]}" # Remove trailing [ID]
# Update JSON title only
if command -v jq >/dev/null 2>&1; then
tmpfile=$(mktemp)
jq --arg newtitle "$title" '.title = $newtitle' "$f" > "$tmpfile" && mv "$tmpfile" "$f"
echo "Updated title in $f: $title"
else
# Simple sed fallback
sed -i "s/\"title\": *\"\"/\"title\": \"$title\"/" "$f"
echo "Updated title in $f: $title (using sed)"
fi
done