mirror of
https://github.com/kuhyx/testsAndMisc.git
synced 2026-11-11 21:54:00 +01:00
organize_downloads.sh 513 -> 72, setup_kcd2_dice_solver.sh 497 -> 112, fix_ubuntu_performance.sh 494 -> 150. First 490+ line scripts done; all three needed two or three seams. Repeated splitting chained the libs - each sourced the next, because the tool inserts its source line relative to the file it just wrote. Flattened so the entry sources all three and no lib sources a sibling. diagnose_pacman_hook_stall.sh is reverted and stays at 493. Its transaction runner assigns LAST_ELAPSED that the caller reads and reads PACMAN_BIN that the caller defines, so linted alone it is SC2034 plus SC2153. The pre-commit hook lints each lib in isolation and fails, while shellcheck -x on the entry passes - suppressing that would be papering over a seam that does not exist. organize_downloads.sh is the ExecStart of media-organizer.service; the unit still resolves and the script still parses. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011w2Pj4Ek3ZNMQVYcFHgXDY
30 lines
729 B
Bash
Executable File
30 lines
729 B
Bash
Executable File
#!/bin/bash
|
|
# Media-type classification for the download sweep.
|
|
#
|
|
# Sourced by organize_downloads.sh; split out to keep it under the 250-line cap.
|
|
# Sourced rather than run, so it inherits the caller's strict mode and
|
|
# the helper functions and variables defined above the source line.
|
|
|
|
# Function to check if file has media extension (zero forks: bash 4 ${var,,})
|
|
is_media_file() {
|
|
local file="$1"
|
|
local extension="${file##*.}"
|
|
extension="${extension,,}"
|
|
|
|
# Check if it's an image
|
|
for ext in "${IMAGE_EXTENSIONS[@]}"; do
|
|
if [[ $extension == "$ext" ]]; then
|
|
return 0
|
|
fi
|
|
done
|
|
|
|
# Check if it's a video
|
|
for ext in "${VIDEO_EXTENSIONS[@]}"; do
|
|
if [[ $extension == "$ext" ]]; then
|
|
return 0
|
|
fi
|
|
done
|
|
|
|
return 1
|
|
}
|