Play Azan (aka Adhan) MPEG files at correct times daily to one or more Chromecast Speaker devices (e.g. Google Home mini). Currently on Raspberry Pi (hence the user pi) but can be run on any Python 3 capable box
This program updates the crontab for user pi to to include 2 programs to be run at reboot and multiple Azan/other media as needed. You will need to edit this file to add lines to setup the string strPlayFajrAzaanMP3Command and add the call to function addAzaanTime().
- Raspberry Pi (3 or better) with NOOBS installed, select Full Install of Raspbian OS (this gives you full GUI, etc). I have used default user pi but any other user can be used. You will need to update the program as paths are hardcoded so far.
- Make sure you have Python 3 installed and updated.
- You will need to add Python modules that are used for "import" command in the .py files. Use command: pip3 install
- Download as zip file. and unzip in /home/pi as user pi.
- From the /home/pi/AZAN folder run: python3 /home/pi/AZAN/updateAzaanTimers.py
- Reboot either from the Raspberry Menu at top left corner of screen or Run from command line: pi@raspberrypi:~ $ sudo reboot That is it! It is important that a reboot is needed to start the webserver serving the media files.
This program updates the crontab for user pi to to include 2 programs to be run at reboot and multiple Azan/other media as needed. You will need to edit this file to add lines to setup the string strPlayFajrAzaanMP3Command and add the call to function addAzaanTime().
You can view the crontab by running the following command at command line: crontab -l
There are 5 items to be personalized early in this file:
- Latitude & Longitude (use sites like latlong.net to find your town's or home's latitude/longitude
- Chromecast Speakers, e.g. "Family Room speaker","Bed Room speaker"
- Azan volume
- Azan times calculation method e.g. "ISNA" OR "MWL" OR "EGYPT" OR "MAKKAH" OR "KARACHI" OR "TEHRAN" OR "JAFARI"
- Timezone e.g. "America/New_York", etc
Credits and history: As a starting point I got the main code from a friend who had downloaded "possibly" from https://github.com/achaudhry/adhan. The code was downloaded 3+ years ago, in Python 2 and had been updated by my friend over the years to work to wired speakers. My additional needs were:
- Play to Google Home (Chromecast capable) devices
- Be self contained i.e. not needing external media server so it has one less dependency.
I will add more description later. Feel free to comment. Apology: I realize this is YAAP (Yet Another Azan Player) but I felt I needed to put this together. There is another player https://github.com/OJ7/AdhanCast which also seems like a good and clean implementation.
- Put configuration/personalization via interactive Azanconfig.py to write to Azan.conf file. This will make selection of devices names simpler.
- Change user to azan instead of default pi. Set AZANHOME path variable accordingly
- List all Python modules to be installed in requirements.txt