blob: bde7b96db3213d7985e677f003dc7440e1f27a6d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
#!/bin/bash
if [[ $# -lt 4 ]]; then
echo "$0: size input_file_name output_file_name input_uri"
exit 255
fi
SIZE="$1"
INPUT_FILE_NAME="$2"
OUTPUT_FILE_NAME="$3"
INPUT_URI="$4"
covers=("$INPUT_FILE_NAME"/{.,}{folder,cover}.{jpg,png,svg})
for file in "${covers[@]}"; do
if [[ -f "$file" ]]; then
cover="$file"
break
fi
done
if [[ -z "$cover" ]] || ! convert -background none -thumbnail "$SIZE" "$cover" "$OUTPUT_FILE_NAME"; then
gdbus call \
--session \
--dest org.freedesktop.thumbnails.Cache1 \
--object-path /org/freedesktop/thumbnails/Cache1 \
--method org.freedesktop.thumbnails.Cache1.Delete "['$INPUT_URI']" >/dev/null
fi
|