Skip to main content

Bridge that takes incoming IRC messages and converts them to other formats

Project description

Build Status PyPI version

chat_transformer

Translates incoming IRC messages to OSC, HTTP, or any other output format you need.

Installation

chat_transformer can be installed using pip:

pip install chat_transformer

Set up

You must create a json file that specifies that mapping of IRC messages to output data. The file must contain a JSON object, where each KEY is an IRC command/message, and the VALUE is a JSON object with the parameters for converting the IRC message to OSC commands. For example:

{
    "brightness": {
        "address": "/osc/brightness/",
        "min": 0.0,
        "max": 2.0,
        "delta": 0.1,
        "initial": 1.0,
        "outputs": {
            "osc": {"address": "/video/brightness"},
            "http": {"command_name": "brightness"}
        }
    },
    ....
}

With the above targets data, the following IRC message:

brightness set 0.75

would translate to the following OSC Message:

/osc/brightness 0.75

and the following POST message to the main HTTP target:

{brightness: {"value": 0.75, "min": 0.0, "max": 2.0}}

Usage

chat_transformer can be run as a CLI command. At minimum, you must specify the location of a config file that will hold the various settings necessary for running chat_transformer:

chat_transformer --config /path/to/my/config.json

Or with the shorthand commands:

chat_transformer -c /path/to/my/config.json

Rather than specifying options as command-line arguments, options can instead be set as environment variables:

export CHAT_TRANSFORMER_CONFIG=/path/to/my/config.json
chat_transformer

Command Line Options

Argument Env variable name Description Default
-c, --config CHAT_TRANSFORMER_CONFIG filepath of the config JSON file config.json
-v, --verbosity How verbose to make the output 1 (Info)

Configuration File

The configuration JSON file holds all the necessary settings for running your instance of chat_transformer. At bear minimum it must include an irc key with the server and login information, a commands key with information about the the commands JSON file (which contains the list of active commands to listen for and respond to), and at least one output (osc and http are supported out of the box). Here's an example of a minimal configuration file that's listening to freenode:

{
    "irc": {
        "server": "chat.freenode.net"
    },
    "commands": {
        "filename": "/path/to/my/commands.json"
    },
    "outputs": {
        "osc": {
            "port": 9876
        }
    }
}

Configuration File Ooptions

Key Description Default
irc.server Server address of the IRC Server None (Required)
irc.port Port number of the IRC Server 6667
irc.nickname Nickname for authnenticating on IRC None (Required)
irc.password Password for authentication on the IRC server
irc.username Username for authentication on the IRC server irc.nickname (above)
irc.realname Real name on on the IRC server
irc.channel IRC channel to join and listen for incoming commands. irc.nickname (above)
commands.filename Path of the file that holds the IRC commands to listen commands.json
commands.watch Reload the commands file when it has changed on disk False
commands.watch_interval Time (in seconds) between checking for file changes 60
output.osc.ip IP Address of the OSC target 127.0.0.1
output.osc.post Port of the OSC target None (Required if OSC is used)
output.http.base_url URL target to post to None (Required if HTTP is used)
output.http.jwt_secret JWT secret for using JWT encoding

Commands File Options

Key Description Default
min Mininum possible value for this command 0.0
max Maximum possible value for this command 1.0
delta Amount to change whenever an INCREMENT or DECREMENT command is received 0.05
initial Initial value for this command 0.5
outputs.osc.address OSC Address to which the message should be send
outputs.http.command_new Key to used for the POSTed HTTP data
outputs.http.endpoint Endpoint to POST to for this command

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

chat_transformer-0.5.0.tar.gz (14.6 kB view details)

Uploaded Source

Built Distribution

chat_transformer-0.5.0-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file chat_transformer-0.5.0.tar.gz.

File metadata

  • Download URL: chat_transformer-0.5.0.tar.gz
  • Upload date:
  • Size: 14.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.0 CPython/3.6.4

File hashes

Hashes for chat_transformer-0.5.0.tar.gz
Algorithm Hash digest
SHA256 e04c6643bcf2d6fdd652c5fd9d95703957a71d055916860300d5b180ea50b158
MD5 56a0f13b7fcf71b5ac6e1ce580001e23
BLAKE2b-256 f37f63a26b5efab6474404d1656cdb5a5bdd5d7685d29991dc8d5856ea415c6e

See more details on using hashes here.

File details

Details for the file chat_transformer-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: chat_transformer-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 19.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.0 CPython/3.6.4

File hashes

Hashes for chat_transformer-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a3c4dbd15cfbe80e516e1c6baf998ff2b408bf1f327a24ec6b0eb0064526e816
MD5 ac49129adf97627b84f63475105c4135
BLAKE2b-256 32d3867067148bbe9979e820db67a8bfcb82e4811cc72a705b3bac132646ece6

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