Skip to main content

Get Quranic audio and images easily.

Project description

AyahSender

AyahSender is a Python package that allows you to have Quranic audio and images easily.

Features

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

Installation

Install the package via pip:

pip install ayah-sender

Requirements

  • requests
  • pydub
  • ffmpeg - PyDub requires ffmpeg to perform its operations.

Follow the articles to install ffmpeg on your system if you don't have it installed.

Usage

Basic Usage

Here is an example of how to use AyahSender:

from ayah_sender import AyahSender

ayahSender = AyahSender()

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

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

# Save the single ayah audio
ayahSender.save_audio(audio_data, output_dir='.')

# 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
ayahSender.save_audio(merged_audio_data, output_dir='.')

# Getting png image of an ayah
ayahSender.get_image(chapter_num=2, verse_num=255, output_dir='ayah-png')

Functions

get_total_verses_in_chapter(chapter_number)

  • Fetches the total number of verses in a given chapter.

get_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.

get_image(chapter_num, verse_num, output_dir='.')

  • Fetches and saves png image of an ayah

Reciters List

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

Example

See examples folder for examples.

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.

Acknowledgement

  • everyayah.com - Jazahumullahu Khairan to them for the audio files.
  • Quran.com - Jazahumullahu Khairan to them for the API.

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.6.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

ayah_sender-0.1.6-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for ayah_sender-0.1.6.tar.gz
Algorithm Hash digest
SHA256 dff815fd502d3a530248453bdd5835d051743948f3155f18d28fe7cad2706a8b
MD5 db8ccdda446fe46accad3995ab532bf1
BLAKE2b-256 65d4f3dd202a933fdf7f9cd3f3f647c41d2ab2e48de5a627b7473fc18d812c1b

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for ayah_sender-0.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 1b57aef017addde1fc4b2f01b45ba1eae52357082a637561f35503648bfa5021
MD5 346c07a055e9eb0da30eff9a86ff2814
BLAKE2b-256 2952a52318435b59bd464fcb8d4511e923db42d0bbd538bbfc174b5277e8c15a

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