Giter VIP home page Giter VIP logo

onhold's Introduction

๐Ÿ”Š 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="http://releases.ubuntu.com/releases/21.04/ubuntu-21.04-desktop-amd64.iso"
$ http "$URL" | pv | onhold | ding > /dev/null

This project uses play_sounds, a wrapper over playsound and boombox.

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!

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.mp3"
$ 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.mp3
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!

ding is its own package, too

You can install ding by itself. Future versions of onhold will not ship with ding. Click here to visit ding's project page with installation instructions.

Installation

Dependencies

  • A Unix shell like Bash, or PowerShell or Command Prompt on Windows
  • Python 3.6+
  • requirements.txt

Linux

You'll need to install GStreamer on Linux, or the play binary from sox.

Ubuntu

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

Arch

On Arch, you can install onhold or onhold-git and its prerequisites directly from the AUR. Thanks, @jfrcom!

$ yay -S onhold # replace yay with your aur helper

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.
  -b, --bell             Ring the terminal bell, as well.  [default: False]
  -w, --warn             Show 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.
  -b, --bell             Ring the terminal bell, as well.  [default: False]
  -w, --warn             Show warnings.
  --help                 Show this message and exit.

Support

Want to support this project and other open-source projects like it?

Buy Me A Coffee

License

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

onhold's People

Contributors

alexdelorenzo avatar jfrcom avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

onhold's Issues

Change pitch or tempo based on data rate

Are there any plans to support various audio filters that are controlled by the data rate of stdout (and maybe stderr)?

This might require a more powerful machine to play, but the possibilities might be a fun way to visualise what's happening. Changing pitch or changing tempo might indicate that stdout is being produced faster, but applying a varying amount of "static noise" or "crosstalk" interference over the audio would audibly indicate that something is being produced at stderr and that maybe it's worth checking the console to see what happened.

Why is detect needed? It's raising a warning when updating onhold

I got a warning when updating onhold, seems a conflict version with detect:

Collecting onhold
  Downloading https://files.pythonhosted.org/packages/0e/a5/4889ed8efca978f722ad55a3cd7af17ee95569ec1f386922543ae2aec92f/onhold-0.4.1-py2.py3-none-any.whl
Requirement already satisfied, skipping upgrade: click==7.1.2 in ./.local/lib/python3.8/site-packages (from onhold) (7.1.2)
Requirement already satisfied, skipping upgrade: boombox==0.56 in ./.local/lib/python3.8/site-packages (from onhold) (0.56)
Requirement already satisfied, skipping upgrade: play-sounds==0.0.5 in ./.local/lib/python3.8/site-packages (from onhold) (0.0.5)
Requirement already satisfied, skipping upgrade: playsound==1.2.2 in ./.local/lib/python3.8/site-packages (from onhold) (1.2.2)
Collecting detect==2020.7.1
  Downloading https://files.pythonhosted.org/packages/b3/1b/14c1e04f5bdf1a10f1d2eaf1a49cd6bf464626e88eeebd5ccab129f6f09e/detect-2020.7.1.tar.gz
  WARNING: Requested detect==2020.7.1 from https://files.pythonhosted.org/packages/b3/1b/14c1e04f5bdf1a10f1d2eaf1a49cd6bf464626e88eeebd5ccab129f6f09e/detect-2020.7.1.tar.gz#sha256=d586c385fff618f79c8385e38c9e26e0ec70071a6fe6af46ab7c93b0d76bdfb1 (from onhold), but installing version 0.0.0
ERROR: onhold 0.4.1 has requirement detect==2020.7.1, but you'll have detect 0.0.0 which is incompatible.
Installing collected packages: detect, onhold
    Running setup.py install for detect ... done
Successfully installed detect-0.0.0 onhold-0.4.1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.