From 727d7e8a6b2fbe955e671496c952c515b7a4a6d1 Mon Sep 17 00:00:00 2001 From: gpkvt Date: Sun, 14 Aug 2022 18:45:30 +0200 Subject: [PATCH] Added support for TTS bot (draft) --- README.md | 59 +++++++++++-------- build/nginx/nginx.conf | 6 ++ build/scripts/lib/config.py | 5 +- build/www/index.py | 10 +++- build/www/obs_settings.py | 1 + .../docker-compose.override.example.yml | 2 + 6 files changed, 57 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index f73a60e..6cbacc7 100644 --- a/README.md +++ b/README.md @@ -6,20 +6,20 @@ Provides tools and services for IRL streaming with OBS Studio as Docker Containe You will need: - * [OBS Studio](https://obsproject.com/download) - * [OBS Websocket](https://obsproject.com/forum/resources/obs-websocket-remote-control-of-obs-studio-made-easy.466/) - * [VLC](https://www.videolan.org/vlc/index.html) - * [git](https://git-scm.com/downloads) - * [Docker](https://docs.docker.com/docker-for-windows/install/) - * [Live U Solo](https://gosolo.tv) +* [OBS Studio](https://obsproject.com/download) +* [OBS Websocket](https://obsproject.com/forum/resources/obs-websocket-remote-control-of-obs-studio-made-easy.466/) +* [VLC](https://www.videolan.org/vlc/index.html) +* [git](https://git-scm.com/downloads) +* [Docker](https://docs.docker.com/docker-for-windows/install/) +* [Live U Solo](https://gosolo.tv) ## RTMP Endpoint - * Port `1935` +* Port `1935` ## Webserver - * Port `80` +* Port `80` ## docker-compose.yml @@ -33,7 +33,7 @@ You can find an example in: `./examples/docker-compose/docker-compose.override.e Use `powershell`, `cmd` or an WSL2 instance and go to the desired location on your local machine (e.g. `c:\users\IRL\`) using `cd`. Then execute the following command: -``` +``` lang="bash" git clone https://gitlab.com/gpvkt/twitch-irl-docker.git ``` @@ -43,27 +43,27 @@ This process must be done only once. The repo content will be cloned into the su Use the `powershell` or `cmd` to go to your repo directory on your local machine (e.g. `c:\users\IRL\docker\`) using `cd`. Remember to create your `docker-compose.override.yml`. Then simply run the following command to start the Container, if needed docker-compose will start the build process. -``` +``` lang="bash" docker-compose up ``` If the container starts successfully you should see something like (followed by more or less verbose status messages depending on your log level): -``` -rtmp_1 | fcgiwrap STARTING -rtmp_1 | ircbot STARTING -rtmp_1 | liveucollector STARTING -rtmp_1 | nginx STARTING -rtmp_1 | obsctl STARTING -rtmp_1 | php STARTING -rtmp_1 | rtmpcollector STARTING +``` lang="bash" +rtmp_1 | fcgiwrap STARTING +rtmp_1 | ircbot STARTING +rtmp_1 | liveucollector STARTING +rtmp_1 | nginx STARTING +rtmp_1 | obsctl STARTING +rtmp_1 | php STARTING +rtmp_1 | rtmpcollector STARTING ``` ### Update image To update your Docker image run the following commands inside your repo directory (e.g. `c:\users\IRL\docker\`): -``` +``` lang="bash" git pull docker-compose build docker-compose up -d @@ -73,14 +73,14 @@ docker-compose up -d If something works wrong you can examine the status of your container by running `docker-compose logs`. To get even more informations you can switch inside your running container by executing `docker-compose exec rtmp /bin/zsh`. Once you're inside the container you can examine the logfiles of all processes using the following commands: -``` +``` lang="bash" cat /var/log/supervisor/nginx.log cat /var/log/supervisor/irl.log ``` To see the status of the processes or to restart them you can use the following commands: -``` +``` lang="bash" supervisorctl status supervisorctl restart nginx @@ -94,7 +94,7 @@ supervisorctl restart ircbot If your docker image doesn't not reflect the expected changes after pulling an repo update run the following commands inside your repo directory: -``` +``` lang="bash" git pull origin master docker-compose kill docker-compose rm --force @@ -104,7 +104,9 @@ docker-compose up -d ## OBS Studio -After installation OBS Studio you need to add the obs-websocket plugin (https://obsproject.com/forum/resources/obs-websocket-remote-control-obs-studio-from-websockets.466/). We recommend using the 64 bit versions. Use a strong password, as you may need to expose the websocket port to the internet. +After installation OBS Studio you need to add the [obs-websocket plugin](https://github.com/obsproject/obs-websocket). We recommend using the 64 bit versions. You don't need to expose the websocket port to the internet, but choose a strong password anyway. + +IMPORTANT: There are two version of `obs-websocket`, you will need the `4.x.x-compat` version. We will update to 5.x.x in a future version of this project. Also you need to add the required scenes in OBS, you will find an importable example in `./examples/obs/IRL.json`. Please note that the example uses an VLC source for RTMP, so you need to have VLC installed. If you use OBS 64 bit you will need to use VLC 64 bit as well. @@ -119,3 +121,14 @@ An webbased OBS Remote Interface is included. You can reach it via `http://local ## Router/Firewall You need to expose the RTMP Port (e.g. `1935`) and the webserver port (e.g. `80`) to the internet. Please configure your router and/or firewall accordingly. We also recommend to use an fixed IP Address for your Server, if you don't have one use an DynDNS service to get an domain name that always matches your current IP. + +## TTS + +You can integrate the [Simple TTS Bot](https://gitlab.com/gpkvt/twitchtts) into OBS Web Remote. Simply follow the installation process included in the bots README.md but use `localhost` as `http_bind` and `3000` as `http_port`. + +Then add the following config to your `docker-compose.override.yml`: + +``` lang="yaml" +# Integrate external TTS-Bot (see https://gitlab.com/gpvkt/twitchtts/) +- TTS=True +``` diff --git a/build/nginx/nginx.conf b/build/nginx/nginx.conf index a1139a4..141f92f 100644 --- a/build/nginx/nginx.conf +++ b/build/nginx/nginx.conf @@ -41,6 +41,12 @@ http { try_files $uri $uri/index.py; } + location /tts { + proxy_pass http://localhost:3000; + proxy_redirect off; + proxy_buffering off; + } + error_page 500 502 503 504 /50x.html; location = /50x.html { root /var/www/html; diff --git a/build/scripts/lib/config.py b/build/scripts/lib/config.py index 0210ecc..31376ac 100644 --- a/build/scripts/lib/config.py +++ b/build/scripts/lib/config.py @@ -59,7 +59,8 @@ vars = [ 'DAYFLAT', 'CHAT_HEIGHT', 'DEBUG', - 'EXTDATA' + 'EXTDATA', + 'TTS' ] def get_config(): @@ -91,7 +92,7 @@ def get_config(): else: logging.warning('Using external data source') conf['EXTDATA'] = True - + if not conf['DAYFLAT']: logging.warning('DAYFLAT is not set, using default') conf['DAYFLAT'] = False diff --git a/build/www/index.py b/build/www/index.py index c4fcd34..f384809 100644 --- a/build/www/index.py +++ b/build/www/index.py @@ -43,6 +43,8 @@ liveu = obs_settings.liveu offline_scene = obs_settings.offline_scene channel = obs_settings.channel chat_height = obs_settings.chat_height +tts = obs_settings.tts + if not chat_height: chat_height = int(500) @@ -110,7 +112,13 @@ if connected: print('
') print(' '.format(str(channel))) print('
Show/Hide chat
') - print('
') + print('') + + if tts: + print('
') + print(' ') + print('
Show/Hide chat
') + print('
') print('
') print('
') diff --git a/build/www/obs_settings.py b/build/www/obs_settings.py index 1f5f37c..a8d0e65 100644 --- a/build/www/obs_settings.py +++ b/build/www/obs_settings.py @@ -13,3 +13,4 @@ channel = os.environ.get('IRC_CHANNEL', False) debug = os.environ.get('DEBUG', False) chat_height = os.environ.get('CHAT_HEIGHT', 500) extdata = os.environ.get('EXTDATA', False) +tts = os.environ.get('TTS', False) diff --git a/examples/docker-compose/docker-compose.override.example.yml b/examples/docker-compose/docker-compose.override.example.yml index 39d6d84..709ce29 100644 --- a/examples/docker-compose/docker-compose.override.example.yml +++ b/examples/docker-compose/docker-compose.override.example.yml @@ -86,3 +86,5 @@ services: - LOG_LEVEL=CRITICAL # Use external data (see Wiki for details) - EXTDATA=False + # Integrate external TTS-Bot (see https://gitlab.com/gpvkt/twitchtts/) + - TTS=False