This projects uses a python script which automatically calculates adhan times every day and plays all five adhans at their scheduled time using cron.
git
$ sudo apt-get install git
home
directory. (Tip: run $ cd ~
to go to your home directory)
$ git clone <get repo clone url from github and put it here>
adhan
direcotry in your home
directory. Run this command:
$ /home/pi/adhan/updateAzaanTimers.py --lat <YOUR_LAT> --lng <YOUR_LNG> --method <METHOD>
Replace the arguments above with your location information and calculation method:
If everythig worked, your output will look something like this:
20 60 Egypt 0 0
05:51
11:52
14:11
16:30
17:53
51 5 * * * /home/pi/adhan/playAzaan.sh /home/pi/adhan/Adhan-fajr.mp3 0 # rpiAdhanClockJob
52 11 * * * /home/pi/adhan/playAzaan.sh /home/pi/adhan/Adhan-Madinah.mp3 0 # rpiAdhanClockJob
11 14 * * * /home/pi/adhan/playAzaan.sh /home/pi/adhan/Adhan-Madinah.mp3 0 # rpiAdhanClockJob
30 16 * * * /home/pi/adhan/playAzaan.sh /home/pi/adhan/Adhan-Madinah.mp3 0 # rpiAdhanClockJob
53 17 * * * /home/pi/adhan/playAzaan.sh /home/pi/adhan/Adhan-Madinah.mp3 0 # rpiAdhanClockJob
0 1 * * * /home/pi/adhan/updateAzaanTimers.py >> /home/pi/adhan/adhan.log 2>&1 # rpiAdhanClockJob
@monthly truncate -s 0 /home/pi/adhan/adhan.log 2>&1 # rpiAdhanClockJob
Script execution finished at: 2017-01-06 21:22:31.512667
If you look at the last few lines, you'll see that 5 adhan times have been scheduled. Then there is another line at the end which makes sure that at 1am every day the same script will run and calculate adhan times for that day. And lastly, there is a line to clear logs on a monthly basis so that your log file doesn't grow too big.
Note that for later runs you do not have to supply any arguments as they are saved in /home/pi/adhan/.settings
.
VOILA! You're done!! Plug in your speakers and enjoy!
Please see the manual for advanced configuration instructions.
There are 2 additional arguments that are optional, you can set them in the first run or
further runs: --fajr-azaan-volume
and azaan-volume
. You can control the volume of the Azaan
by supplying numbers in millibels. To get more information on how to select the values, run the command with -h
.
Sometimes it is needed to run custom commands either before, after or before and after playing adhan. For example, if you have Quran playing continuously, you would want to pause and resume the playback. Another example, is to set your status on a social network, or a calendar, to block/unblock the Internet using pi.hole rules, ... etc.
You can easily do this by adding scripts in the following directories:
before-hooks.d
: Scripts to run before adhan playbackafter-hooks.d
: Scripts to run after adhan playbackTo pause/resume Quran playback if using the RPi_QuranSpeaker project, place the following in 2 new files under the above 2 directories:
# before-hooks.d/01-pause-quran-speaker.sh
#!/usr/bin/env bash
/home/pi/RPi_QuranSpeaker/pauser.py pause
# after-hooks.d/01-resume-quran-speaker.sh
#!/usr/bin/env bash
/home/pi/RPi_QuranSpeaker/pauser.py resume
Do not forget to make the scripts executable:
chmod u+x ./before-hooks.d/01-pause-quran-speaker.sh
chmod u+x ./after-hooks.d/01-resume-quran-speaker.sh
crontab -l
/home/pi/adhan/adhan.log
. This way you can keep track of all successful runs and any potential issues. This file will be truncated at midnight on the forst day of each month. To view the output type $ cat /home/pi/adhan/adhan.log
I have made modifications / bug fixes but I've used the following as starting point: