File indexing completed on 2024-04-28 15:39:51

0001 #!/bin/bash
0002 
0003 # SPDX-FileCopyrightText: 2020 Johannes Zarl-Zierl <johannes@zarl-zierl.at>
0004 #
0005 # SPDX-License-Identifier: BSD-2-Clause
0006 
0007 DB="$1"
0008 
0009 if [ ! -r "$DB" ]
0010 then
0011         echo "Usage: $0 /path/to/index.xml" >&2
0012         echo "Shows the file locations for all category icons in an index.xml file." >&2
0013         echo >&2
0014         exit 1
0015 fi
0016 
0017 list_category_icons()
0018 # list_category_icons INDEX.XML
0019 # list all icon names for category icons
0020 {
0021         local DB="$1"
0022         sed -E -n '/\W*<Category/ s/.*icon="([^"]+)".*/\1/p' "$DB"
0023 }
0024 
0025 files_for_icons()
0026 # filter to match icons to their icon files
0027 {
0028         while read icon
0029         do
0030                 kiconfinder "$icon" || echo "$icon not found" >&2
0031         done
0032 }
0033 
0034 list_category_icons "$DB" | files_for_icons