everything works, need some allignment i guess

This commit is contained in:
Shihaam Abdul Rahman 2022-09-09 12:23:16 +05:00
parent b926f2892f
commit b9b1d438ea
Signed by: shihaam
GPG Key ID: 3B007D22E5584980
2 changed files with 64 additions and 21 deletions

View File

@ -1,25 +1,31 @@
#!/bin/bash #!/bin/bash
DATE=$1
ATOLL=$2
ISLAND=$3
INPUT=prayer.png INPUT=prayer.png
OUTPUT=prayer_added.png OUTPUT=prayer_added.png
PRAYERTIMES_CSV="male.csv"
DAY_OF_YEAR=$(($(date -d "@$(date +%s)" +%j) - 1))
rm $OUTPUT > /dev/null rm $OUTPUT > /dev/null
#human() {
# if (( $(( $1 / 60 )) > 9 )) ; then
convertPTToHuman() { # echo "$(( $1 / 60 )):$(( $1 % 60 ))"
# echo $1 # else
if (( $(( $1 / 60 )) > 9 )) ; then # echo "0$(( $1 / 60 )):$(( $1 % 60 ))"
echo "$(( $1 / 60 )):$(( $1 % 60 ))" # fi
else #}
echo "0$(( $1 / 60 )):$(( $1 % 60 ))" human() {
HOUR="$(( $1 / 60 ))"
if (( $(( $1 / 60 )) < 10 )) ; then
HOUR="0$(( $1 / 60 ))"
fi fi
# echo "$(( $1 / 60 )):$(( $1 % 60 ))" MINUTE="$(( $1 % 60 ))"
if (( $(( $1 % 60 )) < 10 )) ; then
MINUTE="0$(( $1 % 60 ))"
fi
echo "$HOUR:$MINUTE"
} }
imagemagick(){ imagemagick(){
TIME=$1 TIME=$1
PRAYER=$2 PRAYER=$2
@ -49,7 +55,7 @@ then
INPUT=$OUTPUT INPUT=$OUTPUT
fi fi
echo Island=$ISLAND Prayer=$PRAYER Date=$DATE File=$OUTPUT echo Prayer=$PRAYER DayOfYear=$DAY_OF_YEAR Time=$TIME File=$OUTPUT
convert $INPUT \ convert $INPUT \
-font $PWD/CourierPrime.ttf \ -font $PWD/CourierPrime.ttf \
@ -59,11 +65,18 @@ convert $INPUT \
$OUTPUT $OUTPUT
} }
imagemagick $DATE fathis Fajr=$(grep "^$DAY_OF_YEAR," $PRAYERTIMES_CSV | cut -d, -f2)
imagemagick $DATE iruaraa Sunrise=$(grep "^$DAY_OF_YEAR," $PRAYERTIMES_CSV | cut -d, -f3)
imagemagick $DATE mendhuru Dhuhr=$(grep "^$DAY_OF_YEAR," $PRAYERTIMES_CSV | cut -d, -f4)
imagemagick $DATE asr Asr=$(grep "^$DAY_OF_YEAR," $PRAYERTIMES_CSV | cut -d, -f5)
imagemagick $DATE magrib Maghrib=$(grep "^$DAY_OF_YEAR," $PRAYERTIMES_CSV | cut -d, -f6)
imagemagick $DATE isha Isha=$(grep "^$DAY_OF_YEAR," $PRAYERTIMES_CSV | cut -d, -f7)
imagemagick $(human $Fajr) fathis
imagemagick $(human $Sunrise) iruaraa
imagemagick $(human $Dhuhr) mendhuru
imagemagick $(human $Asr) asr
imagemagick $(human $Maghrib) magrib
imagemagick $(human $Isha) isha
feh $OUTPUT feh $OUTPUT

30
outputtime.sh Normal file
View File

@ -0,0 +1,30 @@
#!/bin/bash
PRAYERTIMES_CSV="male.csv"
DAY_OF_YEAR=$(($(date -d "@$(date +%s)" +%j) - 1))
human() {
HOUR="$(( $1 / 60 ))"
if (( $(( $1 / 60 )) < 10 )) ; then
HOUR="0$(( $1 / 60 ))"
fi
MINUTE="$(( $1 % 60 ))"
if (( $(( $1 % 60 )) < 10 )) ; then
MINUTE="0$(( $1 % 60 ))"
fi
echo "$HOUR:$MINUTE"
}
Fajr=$(grep "^$DAY_OF_YEAR," $PRAYERTIMES_CSV | cut -d, -f2)
Sunrise=$(grep "^$DAY_OF_YEAR," $PRAYERTIMES_CSV | cut -d, -f3)
Dhuhr=$(grep "^$DAY_OF_YEAR," $PRAYERTIMES_CSV | cut -d, -f4)
Asr=$(grep "^$DAY_OF_YEAR," $PRAYERTIMES_CSV | cut -d, -f5)
Maghrib=$(grep "^$DAY_OF_YEAR," $PRAYERTIMES_CSV | cut -d, -f6)
Isha=$(grep "^$DAY_OF_YEAR," $PRAYERTIMES_CSV | cut -d, -f7)
echo Fajr $(human $Fajr)
echo Sunrize $(human $Sunrise)
echo Dhuhr $(human $Dhuhr)
echo Asr $(human $Asr)
echo Maghrib $(human $Maghrib)
echo Isha $(human $Isha)