-
Notifications
You must be signed in to change notification settings - Fork 0
/
icon.sh
executable file
·56 lines (47 loc) · 1.01 KB
/
icon.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
if [ $# -lt 1 ]
then
echo 'You must specify sticker pack ID!'
exit 1
fi
set_id=$1
l2t_dir=$(dirname $(realpath "${BASH_SOURCE}"))
. "${l2t_dir}/globals.sh"
function clear_dir ()
{
\rm -rf ${icon_dir}
mkdir -p "${icon_dir}"
}
function check_config ()
{
if [ $# -eq 2 ]
then
export pack_icon="${2}"
echo "export pack_icon='${pack_icon}'" > "${icon_config}"
elif [ -f "${icon_config}" ]
then
. "${icon_config}"
fi
if [ -z ${pack_icon+x} ]
then
echo 'Sticker ID preference not found, please specify both sticker pack ID and sticker ID!'
exit 1
fi
}
function resize_icon ()
{
echo -n "Resizing icon... "
resize_png "${resi_dir}/${1}.png" "${icon_dir}/${1}.png" '100x100' true
echo ""
}
function convert_icon ()
{
echo -n "Converting icon... "
convert_img_webm "${icon_dir}/${1}.png" "${icon_dir}/${1}.webm"
echo ""
}
clear_dir
check_config "${@}"
resize_icon "${pack_icon}"
convert_icon "${pack_icon}"