achaudhry / adhan

Raspberry Pi Adhan Clock
39 stars 25 forks source link

Add before/after hooks to run custom actions #10

Closed hammady closed 3 years ago

hammady commented 4 years ago

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:

Example:

To pause/resume Quran playback if using the RPi_QuranSpeaker project, place the following in a new file (e.g. 01-pause-quran-speaker.sh) under the above 2 directories:

#!/usr/bin/env bash
/home/pi/RPi_QuranSpeaker/pauser.py

Do not forget to make the scripts executable:

chmod u+x ./{before,after}-hooks.d/01-pause-quran-speaker.sh
hammady commented 4 years ago

@achaudhry any chance to review this? I'm using it since then with no problems.

achaudhry commented 4 years ago

Yes I'm so sorry to sit on this for so long. Been extremely busy so never got around to it. I'll review/test this in the next couple of days tops.

achaudhry commented 3 years ago

This completely fell off my radar. Just merged it!

hammady commented 3 years ago

lol better late than never 😅 Eid Mubarak!