Skip to content

Latest commit

 

History

History
88 lines (63 loc) · 5.42 KB

File metadata and controls

88 lines (63 loc) · 5.42 KB

PiOSPrayerApp

A dark-themed desktop appliance for Raspberry Pi OS that calculates the five daily Islamic prayer times and automatically plays the adhaan (call to prayer) at each one. Built as a single-file PyQt5 app designed to run full-screen on a wall-mounted Pi.

Python PyQt5 Platform


What it does

  • Astronomical prayer-time calculation — computes Fajr, Dhuhr, Asr, Maghrib and Isha (plus Sunrise, Midnight and the Last Third of the Night) from your coordinates and timezone using the praytimes engine.
  • Six calculation methods — switch between ISNA, MWL, Egypt, Makkah, Karachi and Tehran at runtime.
  • Automatic adhaan playback — a background monitor thread wakes each prayer time and plays the selected recording through pygame, with a per-prayer 🔔/🔕 toggle so you can silence individual prayers.
  • Three ways to set location — automatic IP geolocation, ZIP/region lookup via OpenStreetMap/Nominatim, or manual latitude/longitude entry. Falls back to Makkah if a lookup fails.
  • Voice selection — pick from the bundled recordings or point the app at any custom .mp3 / .wav / .ogg file.
  • Kiosk-friendly — full-screen dark UI, configurable auto-refresh interval, and a top-level restart loop so a crash relaunches the app after 5 seconds.

Screenshot

Full-screen 1280×720 dark interface: prayer times on the left with mute bells, location / calculation-method / voice controls on the right.

(Add a photo of the running Pi here.)

How it works

                 ┌──────────────────────────┐
   IP / ZIP /    │   Location resolver      │   praytimes engine
   manual  ──────▶  geocoder.ipinfo / osm   ├───────────┐
                 └──────────────────────────┘           ▼
                                              ┌────────────────────────┐
   QTimer (auto-refresh) ─────────────────────▶  getTimes(date, coords │
                                              │  , tz, method)          │
                                              └───────────┬────────────┘
                                                          ▼
   Background monitor thread (polls every 5s)   self.pray_times {fajr,…}
   ── within 10s of a scheduled time & enabled ─────▶ pygame plays adhaan

The GUI (AdhaanApp, a QWidget) owns state and rendering. The playback loop (prayer_monitor) runs on a daemon thread and is deliberately decoupled from the widget — it receives three callbacks (get_current_times, get_audio_file, get_adhaan_enabled) rather than reaching into the UI, which keeps the scheduling logic independently testable.

Requirements

pip install PyQt5 pygame geocoder praytimes

Running

git clone https://github.com/biglill/PiOSPrayerApp.git
cd PiOSPrayerApp
python3 app.py

On first run the app creates adhan_votes.json (the voice catalogue) if it isn't present. Bundled adhaan recordings (Makkah, Madinah, and Rabeh Ibn Darah Al Jazairi) live alongside app.py.

Auto-start on Raspberry Pi

To launch on boot, add a desktop-autostart entry (e.g. ~/.config/autostart/adhaan.desktop) or a systemd user service that runs python3 /home/pi/PiOSPrayerApp/app.py. The built-in restart loop keeps the display alive if the process ever exits unexpectedly.

Configuration

Setting Where Notes
Calculation method Dropdown in-app ISNA / MWL / Egypt / Makkah / Karachi / Tehran
Location Location panel in-app Auto (IP), ZIP+region, or manual lat/lng
Adhaan voice Voice dropdown / file picker Reads adhan_votes.json; supports custom files
Per-prayer on/off 🔔 button beside each prayer Mutes/enables that prayer's adhaan
Auto-refresh interval Dropdown in-app 1 / 2 / 5 / 10 / 15 / 30 minutes

Scope & honest notes

This is a personal single-purpose appliance, not a framework:

  • It's one app.py (~490 lines) plus a small JSON voice catalogue and audio files — intentionally simple.
  • The votes numbers shown next to each voice are cosmetic labels; there is no voting mechanism.
  • Prayer-time accuracy depends entirely on the praytimes engine and the resolved coordinates — verify against your local mosque's timetable before relying on it.

License

No license file is currently included. Consider adding MIT (or your preferred license) to make reuse terms explicit.