namaadhu-vaguthu/namaadhuvaguthu.sh

70 lines
929 B
Bash
Raw Normal View History

#!/bin/bash
2022-09-09 11:28:03 +05:00
DATE=$1
ATOLL=$2
ISLAND=$3
INPUT=prayer.png
OUTPUT=prayer_added.png
2022-09-09 03:45:04 +05:00
rm $OUTPUT > /dev/null
2022-09-09 11:28:03 +05:00
convertPTToHuman() {
# echo $1
if (( $(( $1 / 60 )) > 9 )) ; then
echo "$(( $1 / 60 )):$(( $1 % 60 ))"
else
echo "0$(( $1 / 60 )):$(( $1 % 60 ))"
fi
# echo "$(( $1 / 60 )):$(( $1 % 60 ))"
}
imagemagick(){
TIME=$1
PRAYER=$2
case $PRAYER in
fathis)
2022-09-09 03:45:04 +05:00
POSITION='+685+430'
;;
iruaraa)
2022-09-09 03:45:04 +05:00
POSITION='+440+430'
;;
mendhuru)
2022-09-09 03:45:04 +05:00
POSITION='+220+430'
;;
asr)
2022-09-09 03:45:04 +05:00
POSITION='+685+768'
;;
magrib)
2022-09-09 03:45:04 +05:00
POSITION='+440+768'
;;
isha)
2022-09-09 03:45:04 +05:00
POSITION='+220+768'
esac
if [ -f $OUTPUT ]
then
INPUT=$OUTPUT
fi
2022-09-09 03:45:04 +05:00
echo Island=$ISLAND Prayer=$PRAYER Date=$DATE File=$OUTPUT
2022-09-09 11:28:03 +05:00
convert $INPUT \
2022-09-09 03:45:04 +05:00
-font $PWD/CourierPrime.ttf \
-pointsize 48 \
-fill white \
-annotate $POSITION $TIME \
$OUTPUT
}
imagemagick $DATE fathis
imagemagick $DATE iruaraa
imagemagick $DATE mendhuru
imagemagick $DATE asr
imagemagick $DATE magrib
imagemagick $DATE isha
2022-09-09 03:45:04 +05:00
feh $OUTPUT