prayeralarm

command module
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 4, 2021 License: Apache-2.0 Imports: 13 Imported by: 0

README

Prayer Alarm

A cross-platform single binary islamic prayer alarm.

The prayer alarm binary will run the adhan prayer call (audio) based on prayer timings retrieved from the Adhan API - for a specified location.

By default, the prayer call timings are set for:

  • city = Auckland
  • country = NewZealand

How it works

Prayer timings are retrieved on a monthly basis (starting with current month by defaultt). Prayer calls (adhan audio) is played at the respective prayer times.

Config overrides
  • city
  • country
  • offsets - more info below
  • year
  • month - numerical value between 1 and 12 (inclusive)
Prayer time offsets

Offsetting prayer call times is also supported. Prayer call's can be offset by a specified number of minutes by providing an optional offsets flag when running the binary.
For example, to respectively offset the Maghrib and Isha prayer calls to run 5 mins later and 3 mins earlier, the binary can be run with the following flag: -offsets "0,0,0,5,-3"
By default, offsets for all prayer times are set to 0; i.e. 0,0,0,0,0.

Development

Pre-requisites
  • Golang (developed on v1.13)
  • Pre-requsites for sound player dependency Oto - based on OS
    • CGO_ENABLED=1 - the project uses CGO (required by Oto dependency)
Steps

Use the Makefile to test, build and run the project; alternatively manual instructions are defined below.

Install dependencies
go mod download
Build binary
CGO_ENABLED=1 go build
Run binary
  • In foreground

    ./prayeralarm
    
  • Run with overrides - optional city, country and offset flags

    ./prayeralarm -city auckland -country NewZealand -offsets "5,0,-5,-10,0"
    
  • In background (as service) with log file

    nohup ./prayeralarm > adhan.log &
    
    • Kill background process

      kill $(ps -ef | grep prayeralarm| cut -f4 -d" " | head -1)
      

Dependencies

  • Oto for sound playback (playing Adhan audio)
  • go-mp3 for cross-platform MP3 playback (playing Adhan audio)

Licence

License


TODO

  • Integration testing
  • Tagged releases - using semantic versioning
  • Cross-platform release binaries
    • Raspberry Pi release binary
    • Docker based setup - example
  • CI pipeline
  • CD pipeline
    • One workflow should release to my Raspberry PI

Roadmap

  • A web-ui to view prayer calendar - for current day and month
  • Ability to toggle on-off prayer call

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL