{"id":14065908,"url":"https://github.com/alexdelorenzo/onhold","last_synced_at":"2025-04-09T22:19:28.661Z","repository":{"id":55431952,"uuid":"296173080","full_name":"alexdelorenzo/onhold","owner":"alexdelorenzo","description":"🔊 Play sounds while and after shell jobs complete","archived":false,"fork":false,"pushed_at":"2022-01-08T00:40:02.000Z","size":7501,"stargazers_count":159,"open_issues_count":1,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-02T21:07:30.846Z","etag":null,"topics":["bash","command-line","command-line-tool","notifications","pipe","pipeline","play-sounds","python3","shell","song","unix-shell"],"latest_commit_sha":null,"homepage":"https://alexdelorenzo.dev","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alexdelorenzo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"github":["alexdelorenzo"]}},"created_at":"2020-09-16T23:55:52.000Z","updated_at":"2024-12-30T00:17:13.000Z","dependencies_parsed_at":"2022-08-15T00:10:37.389Z","dependency_job_id":null,"html_url":"https://github.com/alexdelorenzo/onhold","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexdelorenzo%2Fonhold","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexdelorenzo%2Fonhold/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexdelorenzo%2Fonhold/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexdelorenzo%2Fonhold/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexdelorenzo","download_url":"https://codeload.github.com/alexdelorenzo/onhold/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248119509,"owners_count":21050780,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash","command-line","command-line-tool","notifications","pipe","pipeline","play-sounds","python3","shell","song","unix-shell"],"created_at":"2024-08-13T07:04:49.004Z","updated_at":"2025-04-09T22:19:28.630Z","avatar_url":"https://github.com/alexdelorenzo.png","language":"Python","funding_links":["https://github.com/sponsors/alexdelorenzo","https://www.buymeacoffee.com/alexdelorenzo"],"categories":["Python"],"sub_categories":[],"readme":"# 🔊 Play sounds while and after shell jobs complete\n\n`onhold` is a command-line utility that allows you to play music while a long job completes.\n\n[`ding`](https://github.com/alexdelorenzo/ding) is command-line utility that will play a sound after a long job completes.\n\nBoth 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`](https://github.com/alexdelorenzo/ding) will be piped right back out.\n\n```bash\n$ echo \"Hello!\" | onhold\nHello!\n```\n\nAs a result, you can build pipelines with `onhold` and [`ding`](https://github.com/alexdelorenzo/ding).\n\nFor example, you can download an ISO with [`http`](https://httpie.org/), visualize the progress with [`pv`](http://www.ivarch.com/programs/pv.shtml), play music with `onhold` while writing to `/dev/null`, and when it's finished, play a sound with [`ding`](https://github.com/alexdelorenzo/ding).\n\n```bash\n$ export URL=\"http://releases.ubuntu.com/releases/21.04/ubuntu-21.04-desktop-amd64.iso\"\n$ http \"$URL\" | pv | onhold | ding \u003e /dev/null\n```\n\nThis project uses [`play_sounds`](https://github.com/alexdelorenzo/play_sounds), a wrapper over [`playsound`](https://pypi.org/project/playsound/) and [`boombox`](https://pypi.org/project/boombox/).\n\n## `onhold`\n\nYou can either set the `$ONHOLD` environment variable to the song you'd like to play, or supply the song with the `-s` flag.\n\n```bash\n$ export ONHOLD=\"~/Music/song.mp3\"\n$ pv /dev/zero | onhold \u003e /dev/null\n```\n\nThis allows you to set `$ONHOLD` in your `~/.bashrc`.\n\nYou can also specify it with a flag.\n\n```bash\n$ pv /dev/zero | onhold -s song.mp3 \u003e /dev/null\n```\n\n`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.\n\n```bash\n$ echo \"Hello!\" | onhold\nHello!\n```\n\n## [`ding`](https://github.com/alexdelorenzo/ding)\n\nYou can either set the `$DING` environment variable to the sound you'd like to play, or supply the sound with the `-s` flag.\n\n```bash\n# You can run ding after a command or as part of a pipeline\n$ export DING=\"~/Music/ding.mp3\"\n$ sleep 5; ding\n$ echo \"Hello!\" | ding\nHello!\n```\n\nThis allows you to set `$DING` in your `~/.bashrc`.\n\nYou can also specify it with a flag.\n\n```bash\n$ echo \"Hello!\" | ding -s ding.mp3\nHello!\n```\n\n[`ding`](https://github.com/alexdelorenzo/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.\n\n```bash\n$ echo \"Hello!\" | ding\nHello!\n```\n\n### [`ding`](https://github.com/alexdelorenzo/ding) is its own package, too\nYou can install [`ding`](https://github.com/alexdelorenzo/ding) by itself. Future versions of `onhold` will not ship with [`ding`](https://github.com/alexdelorenzo/ding). [Click here to visit `ding`'s project page with installation instructions.](https://github.com/alexdelorenzo/ding)\n\n# Installation\n## Dependencies\n - A Unix shell like Bash, or PowerShell or Command Prompt on Windows\n - Python 3.6+\n - `requirements.txt`\n\n### Linux\nYou'll need to install GStreamer on Linux, or the `play` binary from `sox`.\n \n#### Ubuntu\nOn Ubuntu, you will need to install `PyGObject`, `gstreamer1.0-python3-plugin-loader` and `python3-gst-1.0`.\n\n```bash\n$ sudo apt install python3-gi gstreamer1.0-python3-plugin-loader python3-gst-1.0\n```\n\n#### Arch\nOn Arch, you can install `onhold` or `onhold-git` and its prerequisites [directly from the AUR](https://aur.archlinux.org/packages/onhold/). Thanks, [@jfrcom](https://github.com/jfrcom)!\n\n```bash\n$ yay -S onhold # replace yay with your aur helper\n```\n\n## PyPI\n```bash\n$ python3 -m pip install onhold\n```\n\n## GitHub\n```bash\n$ python3 -m pip install -r requirements.txt\n$ python3 setup.py install\n```\n\n# Help\n## `onhold`\n```bash\n$ onhold --help\nUsage: onhold [OPTIONS]\n\n  Play the specified sound file while data is passed in through standard\n  input and passed through standard output.\n\nOptions:\n  -s, --sound_path PATH  Path to sound to play.\n  -b, --bell             Ring the terminal bell, as well.  [default: False]\n  -w, --warn             Show warnings.\n  --help                 Show this message and exit.\n```\n\n## `ding`\n```bash\n$ ding --help\nUsage: ding [OPTIONS]\n\n  Play specified sound after job is complete.\n\nOptions:\n  -s, --sound_path PATH  Path to sound to play.\n  -b, --bell             Ring the terminal bell, as well.  [default: False]\n  -w, --warn             Show warnings.\n  --help                 Show this message and exit.\n```\n\n# Support\nWant to support this project and [other open-source projects](https://github.com/alexdelorenzo) like it?\n\n\u003ca href=\"https://www.buymeacoffee.com/alexdelorenzo\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/v2/default-blue.png\" alt=\"Buy Me A Coffee\" height=\"60px\" style=\"height: 60px !important;width: 217px !important;max-width:25%\" \u003e\u003c/a\u003e\n\n# License\nSee `LICENSE`. If you'd like to use this project with a different license, please get in touch.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexdelorenzo%2Fonhold","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexdelorenzo%2Fonhold","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexdelorenzo%2Fonhold/lists"}