Skip to main content

Text-To-Speech gbp-webhook plugin

Project description

gbp-webhook-tts

A gbp-webhook plugin to speak the name of a machine or machines when a build is pulled for that machine. See gbp-notifications. The tts in gbp-webhook-tts stands for "text to speech".

Installation

gbp-webhook-tts requires gbp-webhook (which requires gbpcli). You should install gbp-webhook-tts in the same (virtual) environment that you installed those two. For example:

$ pip install --user gbp-webhook-tts

or

$ pipx inject gbpcli gbp-webhook-tts

Usage

You should ensure that gbp-notifications is installed on the Gentoo Build Publisher server for which you want to subscribe and the webhook receiver is configured to receive postpull events.

This plugin uses AWS Polly to convert text to to speech. As such it requires you to have an AWS account and an access account to AWS Polly. It uses standard AWS (boto3) environment variables to configure access to AWS and this can be set in the ~/.config/gbp-webhook.conf file. For example:

AWS_ACCESS_KEY_ID=QVCLXRFGNHXLJRSXZQZK
AWS_SECRET_ACCESS_KEY=vRgJyuacKhYPdTEzopGEMxrvWDSSWavXGEROZbdY
AWS_DEFAULT_REGION=us-east-2

On the server

# /etc/gbp-notifications.toml

[recipients]
laptop = { webhook = "https://laptop:5000/webhook|X-Pre-Shared-Key=foobar" }

[subscriptions]
babette = { postpull = ["laptop"] }

As gbp-webhook-tts is a plugin for gbp-webhook, it is picked up automatically when that application is run (see the README for details). In order to be picked up it requires a restart of the gbp-webhook service. In systemd this means

$ systemctl restart --user gbp-webhook

Environment variables

Like gbp-webhook, gbp-webhook-tts can be configured via environment variables. If you are using the (preferred) systemd integration, then they will be defined in ~/.config/gbp-webhook.conf. The following environment variables are recognized:

  • GBP_WEBHOOK_TTS_DELAY: If provided, there will be a delay (in seconds) between the time that the notification is received and the machine name is spoken. The default is 0 meaning no delay.

In addition environment variables prefixed with GBP_WEBHOOK_TTS_PHONETIC_ will be used to pass a "phonetic" translation to the text-to-speech engine. This can be used in cases where the spelling and the sound of a machine name differ, or where the TTS engine misspeaks. For example if one has a GBP machine called "kde-desktop" one could use the environment variable setting:

GBP_WEBHOOK_TTS_PHONETIC_KDE_DESKTOP="kay-dee-ee desktop"

Cache

gbp-webhook-tts caches the audio received from the TTS engine. This is used to both speed up the processing and to save on AWS charges. The cached audio is stored in ~/.cache/gbp-webhook/tts/, for example ~/.cache/gbp-webhook/tts/kde-desktop.mp3. These audio files can be safely deleted and will be re-created on demand.

Tips

I use this plugin in concert with gbp-webhook-playsound, with a 0.8-second delay. So I effectively get a chime followed by the name of the machine.

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

gbp_webhook_tts-1.0.2.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

gbp_webhook_tts-1.0.2-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file gbp_webhook_tts-1.0.2.tar.gz.

File metadata

  • Download URL: gbp_webhook_tts-1.0.2.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for gbp_webhook_tts-1.0.2.tar.gz
Algorithm Hash digest
SHA256 ffe4204b3d0dd024e81d3cc28f336edc95bd081c7cf5152672c54df66a452518
MD5 be00af2210f6018c5afe599aa4d24000
BLAKE2b-256 c2851ee6e6e172f9d1c157d732e0eadbdc3d3f387fce0d043fc193f95dda8e38

See more details on using hashes here.

File details

Details for the file gbp_webhook_tts-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for gbp_webhook_tts-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cab7c8d505a5255b3b0bf95bc5fac52506f90d48aeae5452b7b191c324f9ce8d
MD5 36828f18d9c943966b38e8a855e5d27c
BLAKE2b-256 9613972b94d5545966a6f9f5cf5aaf477fa8ecac79f3958a4302aa5c1fd87b20

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page