Skip to main content

🔊 Play music while and after jobs complete

Project description

🔊 Play sounds while and after shell jobs complete

onhold is a command-line utility that allows you to play music while a long job completes.

ding is command-line utility that will play a sound after a long job completes.

Both utilities will take data that is piped into their standard inputs and pipe it to standard output. That is to say that data piped into onhold and ding will be piped right back out.

$ echo "Hello!" | onhold
Hello!

As a result, you can build pipelines with onhold and ding.

For example, you can download an ISO with http, visualize the progress with pv, play music with onhold while writing to /dev/null, and when it's finished, play a sound with ding.

$ export URL="https://releases.ubuntu.com/20.04.1/ubuntu-20.04.1-desktop-amd64.iso"
$ http "$URL" | pv | onhold | ding > /dev/null

onhold

You can either set the $ONHOLD environment variable to the song you'd like to play, or supply the song with the -s flag.

$ export ONHOLD="~/Music/song.mp3"
$ pv /dev/zero | onhold > /dev/null

This allows you to set $ONHOLD in your ~/.bashrc.

You can also specify it with a flag.

$ pv /dev/zero | onhold -s song.mp3 > /dev/null

onhold comes with a default song that will play if neither $ONHOLD or -s are set. You can use the -w flag to show warnings if $ONHOLD or -s are not set.

$ echo "Hello!" | onhold
Hello!

ding

You can either set the $DING environment variable to the sound you'd like to play, or supply the sound with the -s flag.

# You can run ding after a command or as part of a pipeline
$ export DING="~/Music/ding.ogg"
$ sleep 5; ding
$ echo "Hello!" | ding
Hello!

This allows you to set $DING in your ~/.bashrc.

You can also specify it with a flag.

$ echo "Hello!" | ding -s ding.ogg
Hello!

ding comes with a default sound that will play if neither $DING or -s are set. You can use the -w flag to show warnings if $DING or -s are not set.

$ echo "Hello!" | ding
Hello!

Installation

Dependencies

  • A Unix shell like Bash
  • Python 3.8+
  • requirements.txt

Python

This project uses the assignment expression feature that was introduced in Python 3.8. Read below if you'd like to use this project in an older version of Python.

Older Python Versions

Use this project's Python 3.6 branch named python3.6, which was tested on Python 3.6. It might work on older versions, too.

Linux

  • GStreamer

On Ubuntu, you will need to install PyGObject, gstreamer1.0-python3-plugin-loader and python3-gst-1.0.

sudo apt install python3-gi gstreamer1.0-python3-plugin-loader python3-gst-1.0

PyPI

$ python3 -m pip install onhold

GitHub

$ python3 -m pip install -r requirements.txt
$ python3 setup.py install

Help

onhold

$ onhold --help
Usage: onhold [OPTIONS]

  Play the specified sound file while data is passed in through standard
  input and passed through standard output.

Options:
  -s, --sound_path PATH  Path to sound to play.
  -i, --ignore           Suppress warnings.
  --help                 Show this message and exit.

ding

$ ding --help
Usage: ding [OPTIONS]

  Play specified sound after job is complete.

Options:
  -s, --sound_path PATH  Path to sound to play.
  -i, --ignore           Suppress warnings.
  --help                 Show this message and exit.

License

See LICENSE. If you'd like to use this project with a different license, please get in touch.

Credit

Music

See CREDIT.md.

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

onhold-0.3.7.tar.gz (4.6 kB view details)

Uploaded Source

Built Distributions

onhold-0.3.7-py36-none-any.whl (7.6 MB view details)

Uploaded Python 3.6

onhold-0.3.7-py2.py3-none-any.whl (16.9 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file onhold-0.3.7.tar.gz.

File metadata

  • Download URL: onhold-0.3.7.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.5

File hashes

Hashes for onhold-0.3.7.tar.gz
Algorithm Hash digest
SHA256 dddf4d2c3ba34c11468e800dc6ff843672cb17ab070a55679f8736b735e372db
MD5 d539894d024f9a45cbe552e14ac77589
BLAKE2b-256 9851fffcacfde34abcbe3193f74913dd98721790a6b20538b7a4b1df5bb22c65

See more details on using hashes here.

File details

Details for the file onhold-0.3.7-py36-none-any.whl.

File metadata

  • Download URL: onhold-0.3.7-py36-none-any.whl
  • Upload date:
  • Size: 7.6 MB
  • Tags: Python 3.6
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.5

File hashes

Hashes for onhold-0.3.7-py36-none-any.whl
Algorithm Hash digest
SHA256 85c63a4b9094999cd59a34ed884e4a1f811432de025c17a8272a194568e27e47
MD5 ead456968321415e9f76fcda8b32c683
BLAKE2b-256 90b221652e1eb9ef9d41949a402978f669b010785db4f7670c6df09d897d67e2

See more details on using hashes here.

File details

Details for the file onhold-0.3.7-py2.py3-none-any.whl.

File metadata

  • Download URL: onhold-0.3.7-py2.py3-none-any.whl
  • Upload date:
  • Size: 16.9 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/46.4.0 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.8.5

File hashes

Hashes for onhold-0.3.7-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 cde7f4213189d5dbfa87d2f9530f1586f51f318c9ddfe0f95047fc8d6e70d285
MD5 41f2d21d818a55a91f8282eda79fb737
BLAKE2b-256 2713abc7f831a224643520d67b01b95485979bb649acda2c2b051894266e4d29

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