|
2 | 2 | This projects uses a python script which automatically calculates [adhan](https://en.wikipedia.org/wiki/Adhan) times every day and plays all five adhans at their scheduled time using cron.
|
3 | 3 |
|
4 | 4 | ## Diclaimer
|
5 |
| -I can't take much credit for this at all. Most of the code I've used here is written by other developers (methoned below). I've only cleaned up some pieces and have put plumming in place so that people can get this up and running with minimal effort. |
| 5 | +I can't take much credit for this. A lot of the code I've used here is written by other developers (methoned below). I've only cleaned up some pieces and have put plumming in place so that people can get this up and running with minimal effort. |
6 | 6 |
|
7 | 7 | ### Credits
|
8 | 8 | I have made minor modifications / bug fixes but I've used the following as starting point:
|
@@ -33,40 +33,34 @@ The original python script is super configurable. Please see the [manual](http:/
|
33 | 33 | ```
|
34 | 34 | #Set latitude and longitude here
|
35 | 35 | #--------------------
|
36 |
| -lat = 42.288788 |
37 |
| -long = -71.551678 |
| 36 | +lat = 42.3601 |
| 37 | +long = -71.0589 |
38 | 38 | ```
|
39 | 39 | * Set adhan time [calculation method](http://praytimes.org/manual#Set_Calculation_Method). Modify the following line:
|
40 | 40 | ```
|
41 | 41 | PT.setMethod('ISNA')
|
42 | 42 | ```
|
43 |
| -* And finally, set the time-zone. In the following example it's set to Eastern time hence the `-5`. The `1` after `-5` is for daylight saving. |
44 |
| -``` |
45 |
| -times = PT.getTimes((now.year,now.month,now.day), (lat, long), -5, 1) |
46 |
| -``` |
47 |
| - |
48 | 43 | Save your changes by pressing `Control X` and then `Y`.
|
49 | 44 |
|
50 | 45 | ## Run it for the first time
|
51 | 46 | Run this command `$ python /home/pi/adhan/updateAzaanTimers.py`. If everythig worked, your output will look something like this:
|
52 | 47 | ```
|
53 |
| -03:56 |
54 |
| -12:53 |
55 |
| -16:52 |
56 |
| -20:13 |
57 |
| -21:49 |
58 |
| -<generator object find_command at 0x76a714e0> |
59 |
| -56 3 * * * omxplayer -o local /home/pi/adhan/Adhan-Makkah-Fajr.mp3 > /dev/null 2>&1 # fajr |
60 |
| -53 12 * * * omxplayer -o local /home/pi/adhan/Adhan-Makkah.mp3 > /dev/null 2>&1 # dhuhr |
61 |
| -52 16 * * * omxplayer -o local /home/pi/adhan/Adhan-Makkah.mp3 > /dev/null 2>&1 # asr |
62 |
| -13 20 * * * omxplayer -o local /home/pi/adhan/Adhan-Makkah.mp3 > /dev/null 2>&1 # maghrib |
63 |
| -49 21 * * * omxplayer -o local /home/pi/adhan/Adhan-Makkah.mp3 > /dev/null 2>&1 # isha |
64 |
| -0 1 * * * python /home/pi/adhan/updateAzaanTimers.py >> /home/pi/adhan/adhan.log 2>&1 |
65 |
| -@monthly truncate -s 0 /home/pi/adhan/adhan.log 2>&1 |
66 |
| -Script execution finished at: 2016-07-24 14:59:16.021888 |
| 48 | +05:51 |
| 49 | +11:52 |
| 50 | +14:11 |
| 51 | +16:30 |
| 52 | +17:53 |
| 53 | +51 5 * * * omxplayer -o local /home/pi/adhan/Adhan-Makkah-Fajr.mp3 > /dev/null 2>&1 # rpiAdhanClockJob |
| 54 | +52 11 * * * omxplayer -o local /home/pi/adhan/Adhan-Makkah.mp3 > /dev/null 2>&1 # rpiAdhanClockJob |
| 55 | +11 14 * * * omxplayer -o local /home/pi/adhan/Adhan-Makkah.mp3 > /dev/null 2>&1 # rpiAdhanClockJob |
| 56 | +30 16 * * * omxplayer -o local /home/pi/adhan/Adhan-Makkah.mp3 > /dev/null 2>&1 # rpiAdhanClockJob |
| 57 | +53 17 * * * omxplayer -o local /home/pi/adhan/Adhan-Makkah.mp3 > /dev/null 2>&1 # rpiAdhanClockJob |
| 58 | +0 1 * * * python /home/pi/adhan/updateAzaanTimers.py >> /home/pi/adhan/adhan.log 2>&1 # rpiAdhanClockJob |
| 59 | +@monthly truncate -s 0 /home/pi/adhan/adhan.log 2>&1 # rpiAdhanClockJob |
| 60 | +Script execution finished at: 2017-01-06 21:22:31.512667 |
67 | 61 | ```
|
68 | 62 |
|
69 |
| -If you look at the last 8 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. |
| 63 | +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. |
70 | 64 |
|
71 | 65 | VOILA! You're done!! Plug in your speakers and enjoy!
|
72 | 66 |
|
|
0 commit comments