Add --filter to arr_corruption_scan.sh for targeted testing

Full-library scans are slow to reach any one show by chance — this lets a test
target a specific known-corrupt file/show without waiting on scan order.
This commit is contained in:
Gmer4Lfe
2026-07-18 16:50:33 -04:00
parent ab35fcd84d
commit 77845829ad
+7
View File
@@ -79,6 +79,9 @@
# useful for a bounded first test)
# arr_corruption_scan.sh --log — verbose (prints every clean file too)
# arr_corruption_scan.sh --status — show config and exit
# arr_corruption_scan.sh --filter=Becker — only consider paths containing this substring
# (testing/targeting a specific show; state
# file and everything else behaves normally)
#
# ==============================================================================================
@@ -90,10 +93,12 @@ source "$SCRIPT_DIR/../load_config.sh"
# before they get filtered.
REMEDIATE=false
SCAN_LIMIT=0
PATH_FILTER=""
for _arg in "$@"; do
case "$_arg" in
--remediate) REMEDIATE=true ;;
--limit=*) SCAN_LIMIT="${_arg#*=}" ;;
--filter=*) PATH_FILTER="${_arg#*=}" ;;
esac
done
unset _arg
@@ -171,6 +176,7 @@ if [[ "$SHOW_STATUS" == true ]]; then
echo "$ICON_GEAR State file: $CORRUPTION_SCAN_STATE_FILE"
echo "$ICON_GEAR Remediate: $REMEDIATE"
echo "$ICON_GEAR Scan limit: ${SCAN_LIMIT:-unlimited}"
echo "$ICON_GEAR Path filter: ${PATH_FILTER:-none}"
echo "━━━━━━━━━━━━━━━━━━━━━━━"
exit 0
fi
@@ -287,6 +293,7 @@ while IFS= read -r item; do
host_path=$(translate_path "$api_path")
[[ -f "$host_path" ]] || continue
[[ -n "$PATH_FILTER" && "$host_path" != *"$PATH_FILTER"* ]] && continue
stamp="$(stat -c '%Y:%s' "$host_path" 2>/dev/null)"
[[ -z "$stamp" ]] && continue