Skip to main content

A package to get audio of a single verse or multiples verses from a Chapter of The Holy Quran

Project description

AyahSender

AyahSender is a Python package that allows you to fetch and merge audio of Quranic verses (ayahs) from various reciters. You can save these audio clips to your local directory for easy access and listening.

Features

  • Fetch a single ayah audio.
  • Merge multiple ayahs into a single audio file.
  • Supports various reciters.
  • Saves audio files in MP3 format.

Installation

Install the package via pip:

pip install ayah_sender

Usage

Basic Usage

Here is an example of how to use AyahSender:

from ayah_sender import AyahSender
import json

ayahSender = AyahSender()

# Show available reciters
reciters_dict = ayahSender.reciter.show_reciters()
print(reciters_dict)

# Fetch a single ayah's audio
audio_data = ayahSender.fetch_single_ayah(reciter_id=1, chapter_num=1, verse_num=1)

# Save the single ayah audio
output_file_path = ayahSender.save_audio(audio_data, output_dir='.')
print(f"Audio saved at: {output_file_path}")

# Merge multiple ayahs' audio
merged_audio_data = ayahSender.merge_ayahs(reciter_id=5, chapter_num=1, start_verse=1, end_verse=5)

# Save the merged audio file
output_file_path = ayahSender.save_audio(merged_audio_data, output_dir='.')
print(f"Audio saved at: {output_file_path}")

Functions

get_total_verses_in_chapter(chapter_number)

Fetches the total number of verses in a given chapter.

fetch_single_ayah(reciter_id, chapter_num, verse_num)

Fetches a single ayah from a specified reciter, chapter, and verse.

merge_ayahs(reciter_id, chapter_num, start_verse, end_verse)

Fetches and merges a range of ayahs from a specified reciter and chapter.

save_audio(audio_data, output_dir=".")

Saves the audio data to the specified directory.

File Structure

ayah-sender/
├── ayah_sender/
│   ├── __init__.py
│   ├── main.py
│   ├── reciter.py
│   ├── reciters.csv
├── setup.py
└── README.md

Reciters List

The reciters.csv file contains the list of reciters. The Reciter class reads this file to fetch reciter information.

Example

from ayah_sender import AyahSender

ayahSender = AyahSender()
audio_data = ayahSender.fetch_single_ayah(reciter_id=1, chapter_num=1, verse_num=1)
ayahSender.save_audio(audio_data, output_dir='.')

Contributing

Feel free to submit issues or pull requests. For major changes, please open an issue first to discuss what you would like to change.

License

MIT License

Contact

For any queries, contact us at dev.asib@proton.me.


Enjoy using AyahSender for your Quranic audio needs!

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

ayah_sender-0.1.4.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

ayah_sender-0.1.4-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file ayah_sender-0.1.4.tar.gz.

File metadata

  • Download URL: ayah_sender-0.1.4.tar.gz
  • Upload date:
  • Size: 5.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for ayah_sender-0.1.4.tar.gz
Algorithm Hash digest
SHA256 1f4dfd0bebc7cf82cef1fd3d68136b51ff76233f6dc87e501dc81692bb4a3548
MD5 527939e1a25b1e879976ac68590fbd26
BLAKE2b-256 bd37f98d45026712ef9e2c4bd073e6ebc86a670896fc5cce7d2032ecba1af819

See more details on using hashes here.

File details

Details for the file ayah_sender-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: ayah_sender-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.4

File hashes

Hashes for ayah_sender-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 60dabb6d371882696bf9f0ff2e8e5aec2b18ba7b6f54532425439e461ea30bc7
MD5 9bf7bfc621f6d24127015e9f28b67d96
BLAKE2b-256 6de5b5e5561f6a14a7a1526313276ae1aa5204d9605cc070a06bcbe65062c40e

See more details on using hashes here.

Supported by

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