Skip to main content

Calculate and Generate Athan and Salah Times

Project description

Zero external dependency Athan calculator

A simple Athan calculator with no external dependencies. Calculates prayer times using latitude, longitude, and elevation.

Installation

pip install athantime

Usage

Run it as a CLI tool, see, getathan --help , example:

getathan -e 100 -l 30 -L -100

Use it in a script:

from athantimes import Athan, print_prayer_times

# create Athan object based on user params
prayer = Athan(
    elev=100,  # Elevation
    lat=30,  # Latitude
    lon=-100  # Longitude
    # asr_method=1,  # jumhoor = 1. hanafi = 2
    # fajr_angle=15,
    # isha_angle=15,
)

# calculate athan times
m_times = prayer.calc_times()

# print prayer table
print_prayer_times(m_times)

# figure out next salah time
athan_time, next_salah = prayer.get_next_salah(m_times)
print(f"Next Athan ({next_salah}) will be called @ {athan_time}")

Output:

Fajr: 4:22:55.791533
Shuruq: 5:27:00.491693
Dhur: 11:31:53.542215
Asr: 14:58:52.500350
Maghrib: 17:36:46.592737
Isha: 18:40:51.292898

Next Athan (fajr) will be called @ 2024-09-24 04:23:30
  • See examples directory for additional usage.
  • sched_athan.py is an example running the library as a background process which execute a command every time an Athan is called. This is useful if you want to play an audio file.

Example Athan Schedule

Assuming there is a shell script which plays audios, a user can play all 5 Athans using this command

python3 examples/sched_athan.py -e 100 -l 30 -L -100

where -e is elevation, -l is longitude, and -L is longitude

This will execute a shell script @ /home/pi/sounds/many.sh whenever it is time for athan.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

athantime-1.0.0.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

athantime-1.0.0-py3-none-any.whl (7.3 kB view details)

Uploaded Python 3

File details

Details for the file athantime-1.0.0.tar.gz.

File metadata

  • Download URL: athantime-1.0.0.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for athantime-1.0.0.tar.gz
Algorithm Hash digest
SHA256 f972aec44d320e95072e7d4c076bc7ee69f1f56aeeb2038bbd25deb54a808ba9
MD5 a1d98d513fce5081cacdc13429fcb523
BLAKE2b-256 0f76a5b66e4bcfe27f276dbb476192696d703127701d1a74b1c04e423efbae45

See more details on using hashes here.

File details

Details for the file athantime-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: athantime-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for athantime-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6f67e41dc89aa3861d92e9c5f6bcba01507048ee0315861c36b6e80c93d50edd
MD5 3463c0f95eae2e4021599b0ce4d25b88
BLAKE2b-256 858e695d053b10013debfd551b8fca12f446ccf08ab1e9c7a1f5811b24f2ba11

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page