~jadedctrl/gem-xwx-moe

~jadedctrl/gem-xwx-moe/gemujo_ludo/mods.niaj/fasado/subtitles/find-missing.sh
 ..
0 #!/usr/bin/env bash
1
2
3 ###############################################################################
4 # #
5 # Subtitles ‘find-missing.sh’ — Lists sounds without descriptions. #
6 # Written in 2022 by Silver Sandstone <@SilverSandstone@craftodon.social> #
7 # #
8 # To the extent possible under law, the author has dedicated all copyright #
9 # and related and neighbouring rights to this software to the public #
10 # domain worldwide. This software is distributed without any warranty. #
11 # #
12 # You should have received a copy of the CC0 Public Domain Dedication #
13 # along with this software. If not, see #
14 # <https://creativecommons.org/publicdomain/zero/1.0/>. #
15 # #
16 ###############################################################################
17
18
19 set -eu
20
21
22 function filter-missing()
23 {
24 while read -r path; do
25 if ! grep -F -q "subtitles.register_description('${path##*/}'," "$(dirname "$0")/descriptions.lua"; then
26 echo "$path"
27 fi
28 done
29 }
30
31
32 dirs=("$@")
33 if [[ "${#dirs[@]}" == 0 ]]; then
34 echo 'Checking installed games and mods.'
35 dirs=(~/.minetest/{mods,games})
36 fi
37
38
39 find -L "${dirs[@]}" -name '*.ogg' \
40 | sed -r 's!(.+)/(\w+)\..*!\1/\2!; t; d' \
41 | sort \
42 | uniq \
43 | filter-missing \
44 | sed -r 's!(.*)/(\w+)!\x1B[2m\1/\x1B[0;1m\2\x1B[m!' \
45 | cat -n