[bin] Fixing bin scripts and adding bus check
This commit is contained in:
@ -64,7 +64,7 @@ for cam in "${WEBCAMS[@]}"; do
|
||||
done
|
||||
|
||||
# --- Update index.html ---
|
||||
INDEX_HTML="$BASE_DIR/index.html"
|
||||
INDEX_HTML="$BASE_DIR/timelapses.html"
|
||||
|
||||
# Ensure file exists with basic structure
|
||||
if [[ ! -f "$INDEX_HTML" ]]; then
|
||||
@ -87,19 +87,19 @@ fi
|
||||
# Build new day's section
|
||||
NEW_SECTION="<h2>$YESTERDAY</h2><ul>"
|
||||
for link in "${LINKS[@]}"; do
|
||||
cam=\$(echo "\$link" | cut -d']' -f1 | tr -d '[]')
|
||||
url=\$(echo "\$link" | awk '{print \$2}')
|
||||
NEW_SECTION+="<li><a href=\"\$url\">\$cam</a></li>"
|
||||
cam=$(echo "$link" | cut -d']' -f1 | tr -d '[]')
|
||||
url=$(echo "$link" | awk '{print $2}')
|
||||
NEW_SECTION+="<li><a href=\"$url\">$cam</a></li>"
|
||||
done
|
||||
NEW_SECTION+="</ul>"
|
||||
|
||||
# Insert at the top of <div id="days">
|
||||
tmpfile=\$(mktemp)
|
||||
awk -v section="\$NEW_SECTION" '
|
||||
tmpfile=$(mktemp)
|
||||
awk -v section="$NEW_SECTION" '
|
||||
/<div id="days">/ { print; print section; next }
|
||||
{ print }
|
||||
' "\$INDEX_HTML" > "\$tmpfile"
|
||||
mv "\$tmpfile" "\$INDEX_HTML"
|
||||
' "$INDEX_HTML" > "$tmpfile"
|
||||
mv "$tmpfile" "$INDEX_HTML"
|
||||
|
||||
echo "📝 Updated index with $YESTERDAY timelapses (newest on top)"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user