-
Notifications
You must be signed in to change notification settings - Fork 27
/
prebuild_graphics.sh
executable file
·56 lines (49 loc) · 1.22 KB
/
prebuild_graphics.sh
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
set -eu # European Union compliance mode
PREFIX="${PREFIX:-.}"
prebuild_app_icon()
{
source="$1"
size="$2"
directory="$PREFIX/data/icons"
[ -d "$directory" ] || mkdir -p "$directory"
set -x
rsvg-convert -w $size -h $size \
"graphics/nuvola-icon/nuvola-player.${source}.svg" \
-o "$directory/${size}.png"
{ set +x; } 2>/dev/null
}
prebuild_web_app_icon()
{
source="$1"
size=48
name="$(basename "$source")"
name="${name%.svg}"
directory="$PREFIX/data/nuvolaplayer3/web_apps/$name"
[ -d "$directory" ] || mkdir -p "$directory"
set -x
rsvg-convert -w $size -h $size \
"${source}" \
-o "$directory/icon.png"
{ set +x; } 2>/dev/null
}
optimize_svg()
{
source="$1"
output="$2"
directory="$(dirname "$output")"
[ -d "$directory" ] || mkdir -p "$directory"
set -x
scour -q -i "$source" -o "$output"
{ set +x; } 2>/dev/null
}
for size in 16; do prebuild_app_icon 16 $size; done
for size in 22 24 32; do prebuild_app_icon 22 $size; done
for size in 48 64; do prebuild_app_icon orig $size; done
optimize_svg \
graphics/nuvola-icon/nuvola-player.orig.svg \
"$PREFIX/data/icons/scalable.svg"
for source in graphics/service-icons/*.svg; do
[[ "$source" != *.*.svg ]] || continue
prebuild_web_app_icon "$source"
done