PyBites Alarm
Play a music file or voice message after an interval of N minutes or seconds.
Install the tool
$ pip install pybites-alarm
$ alarm
usage: alarm [-h] (-s SECONDS | -m MINUTES) [-b | -d] [-l SONG_LIBRARY | -f FILE | -M MESSAGE] [-v] [-t TIMEOUT]
alarm: error: one of the arguments -s/--seconds -m/--minutes is required
Note that you'll need ffmpeg to play an alarm sound file. You'll also need libasound2-dev on Linux. On Windows you will additionally need Visual Studio tools. Currently it does not work great yet on WSL.
Usage
You can specify an interval time using seconds (-s) or minutes (-m).
By default it runs in the foreground, but on Mac/Linux (not Windows) you can run it in the background using -b.
To display the seconds countdown use -d.
There are three ways to play an alarm file:
-
Specify one with
-f. -
Pick a random file from your music library directory. For that use
-l. -
Use a default file by setting
ALARM_MUSIC_FILEin.env, for example:$ cat .env ALARM_MUSIC_FILE=/Users/bbelderbos/Music/alarm.mp4
Voice messages
It can be confusing when a music file plays so since 0.0.4 you can play a voice message instead using -M (--message).
For example:
alarm -M "stand up for a walk" -m 20 -b
A voice repeats "stand up for a walk" three times after 20 minutes. Pretty useful for programmers :)
Duration of the alarm
For long alarm files you can set a timeout to stop the alarm after N seconds using the t (--timeout) switch.
Repeating an alarm
Since version 0.0.6 you can repeat an alarm using the -r switch. For example, to track 25 minute pomodoro time blocks (as per the Pomodoro Technique), you can run this command:
alarm -m 25 -M "pomodoro completed" -r 4
A voice will notify you every 25 minutes (for 4 times) that you have completed a pomodoro.
Another use case is to have it alert you to stand up and drink more water during the day - direct health benefits :)
Here are all the supported options again:
$ alarm -h
usage: alarm [-h] (-s SECONDS | -m MINUTES) [-b | -d] [-l SONG_LIBRARY | -f FILE | -M MESSAGE] [-v] [-t TIMEOUT]
Play an alarm after N minutes
optional arguments:
-h, --help show this help message and exit
-s SECONDS, --seconds SECONDS
Number of seconds before playing alarm (default: None)
-m MINUTES, --minutes MINUTES
Number of minutes before playing alarm (default: None)
-b, --background Run timer in the background (default: False)
-d, --display_timer Show timer in console (default: False)
-l SONG_LIBRARY, --song_library SONG_LIBRARY
Take a random song from a song library directory, supported formats: .mp3, .mp4, .wav (default: None)
-f FILE, --file FILE File path to song to play as alarm (default: None)
-M MESSAGE, --message MESSAGE
Set an audio message to play for alarm (default: None)
-v, --version show program's version number and exit
-t TIMEOUT, --timeout TIMEOUT
Stop alarm after N seconds (default: None)
-r REPEAT, --repeat REPEAT
Repeat alarm cycle N times (only works in foreground) (default: 1)
Again the -b option is not available on Windows, although it seems you can get that working with:
start /b alarm -s 3 -f test.mp3
This backgrounds a process on windows and CTRL + BREAK/SCRLLCK kills it. Or use the -t option, e.g. start /b alarm -s 3 -f test.mp3 -t 20 (thanks Lee!)
Metadata
Release files for pybites-alarm 0.0.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pybites-alarm-0.0.6.tar.gz | 5.2 kB | Without provenance | Details for pybites-alarm-0.0.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pybites_alarm-0.0.6-py3-none-any.whl | Python 3 | none | any | Details for pybites_alarm-0.0.6-py3-none-any.whl |
Total release size: 13.2 kB
Release files / pybites-alarm-0.0.6.tar.gz
| Download URL | pybites-alarm-0.0.6.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
20f93f78b7bb1c36139285ceabef32c191221c916ff6fb91a7c432910322321d
|
|
BLAKE2b-256 checksum How to use checksums |
1beb79ff040251ded3bf56eeaf8a332e70109b0adec371f1cc5ddd2c69608534
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
|
Release files / pybites_alarm-0.0.6-py3-none-any.whl
| Download URL | pybites_alarm-0.0.6-py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4bef7cfefbf8556c40bd8ec143ace4fcafae4ad44d7a8fa3857bedfd18c3a30e
|
|
BLAKE2b-256 checksum How to use checksums |
59905c9e17794f93e03d0b808e25731ac82229bec7acf41f8655837b50665847
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.2 importlib_metadata/4.8.1 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7
|
Security for pybites-alarm 0.0.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.