Added support for TTS bot (draft)

This commit is contained in:
gpkvt 2022-08-14 18:45:30 +02:00
parent 38a3f3dd64
commit 727d7e8a6b
6 changed files with 57 additions and 26 deletions

View File

@ -6,20 +6,20 @@ Provides tools and services for IRL streaming with OBS Studio as Docker Containe
You will need: You will need:
* [OBS Studio](https://obsproject.com/download) * [OBS Studio](https://obsproject.com/download)
* [OBS Websocket](https://obsproject.com/forum/resources/obs-websocket-remote-control-of-obs-studio-made-easy.466/) * [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) * [VLC](https://www.videolan.org/vlc/index.html)
* [git](https://git-scm.com/downloads) * [git](https://git-scm.com/downloads)
* [Docker](https://docs.docker.com/docker-for-windows/install/) * [Docker](https://docs.docker.com/docker-for-windows/install/)
* [Live U Solo](https://gosolo.tv) * [Live U Solo](https://gosolo.tv)
## RTMP Endpoint ## RTMP Endpoint
* Port `1935` * Port `1935`
## Webserver ## Webserver
* Port `80` * Port `80`
## docker-compose.yml ## 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: 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 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. 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 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): If the container starts successfully you should see something like (followed by more or less verbose status messages depending on your log level):
``` ``` lang="bash"
rtmp_1 | fcgiwrap STARTING rtmp_1 | fcgiwrap STARTING
rtmp_1 | ircbot STARTING rtmp_1 | ircbot STARTING
rtmp_1 | liveucollector STARTING rtmp_1 | liveucollector STARTING
rtmp_1 | nginx STARTING rtmp_1 | nginx STARTING
rtmp_1 | obsctl STARTING rtmp_1 | obsctl STARTING
rtmp_1 | php STARTING rtmp_1 | php STARTING
rtmp_1 | rtmpcollector STARTING rtmp_1 | rtmpcollector STARTING
``` ```
### Update image ### Update image
To update your Docker image run the following commands inside your repo directory (e.g. `c:\users\IRL\docker\`): To update your Docker image run the following commands inside your repo directory (e.g. `c:\users\IRL\docker\`):
``` ``` lang="bash"
git pull git pull
docker-compose build docker-compose build
docker-compose up -d 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: 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/nginx.log
cat /var/log/supervisor/irl.log cat /var/log/supervisor/irl.log
``` ```
To see the status of the processes or to restart them you can use the following commands: To see the status of the processes or to restart them you can use the following commands:
``` ``` lang="bash"
supervisorctl status supervisorctl status
supervisorctl restart nginx 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: 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 git pull origin master
docker-compose kill docker-compose kill
docker-compose rm --force docker-compose rm --force
@ -104,7 +104,9 @@ docker-compose up -d
## OBS Studio ## 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. 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 ## 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. 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
```

View File

@ -41,6 +41,12 @@ http {
try_files $uri $uri/index.py; 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; error_page 500 502 503 504 /50x.html;
location = /50x.html { location = /50x.html {
root /var/www/html; root /var/www/html;

View File

@ -59,7 +59,8 @@ vars = [
'DAYFLAT', 'DAYFLAT',
'CHAT_HEIGHT', 'CHAT_HEIGHT',
'DEBUG', 'DEBUG',
'EXTDATA' 'EXTDATA',
'TTS'
] ]
def get_config(): def get_config():
@ -91,7 +92,7 @@ def get_config():
else: else:
logging.warning('Using external data source') logging.warning('Using external data source')
conf['EXTDATA'] = True conf['EXTDATA'] = True
if not conf['DAYFLAT']: if not conf['DAYFLAT']:
logging.warning('DAYFLAT is not set, using default') logging.warning('DAYFLAT is not set, using default')
conf['DAYFLAT'] = False conf['DAYFLAT'] = False

View File

@ -43,6 +43,8 @@ liveu = obs_settings.liveu
offline_scene = obs_settings.offline_scene offline_scene = obs_settings.offline_scene
channel = obs_settings.channel channel = obs_settings.channel
chat_height = obs_settings.chat_height chat_height = obs_settings.chat_height
tts = obs_settings.tts
if not chat_height: if not chat_height:
chat_height = int(500) chat_height = int(500)
@ -110,7 +112,13 @@ if connected:
print('<div id="chat">') print('<div id="chat">')
print(' <iframe id="twitchchat" style="display:none;" scrolling="0" frameborder="0" src="https://www.twitch.tv/embed/{0}/chat?parent=localhost" height="500px" width="100%"></iframe>'.format(str(channel))) print(' <iframe id="twitchchat" style="display:none;" scrolling="0" frameborder="0" src="https://www.twitch.tv/embed/{0}/chat?parent=localhost" height="500px" width="100%"></iframe>'.format(str(channel)))
print(' <div class="status" onClick="$(\'#twitchchat\').fadeToggle(\'slow\', \'linear\');">Show/Hide chat</div>') print(' <div class="status" onClick="$(\'#twitchchat\').fadeToggle(\'slow\', \'linear\');">Show/Hide chat</div>')
print('</div>') print('</div>')
if tts:
print('<div id="tts">')
print(' <iframe id="ttsframe" style="display:none;" scrolling="0" frameborder="0" src="/tts" height="500px" width="100%"></iframe>')
print(' <div class="status" onClick="$(\'#ttsframe\').fadeToggle(\'slow\', \'linear\');">Show/Hide chat</div>')
print('</div>')
print('<div id="stream">') print('<div id="stream">')
print(' <div id="streamform">') print(' <div id="streamform">')

View File

@ -13,3 +13,4 @@ channel = os.environ.get('IRC_CHANNEL', False)
debug = os.environ.get('DEBUG', False) debug = os.environ.get('DEBUG', False)
chat_height = os.environ.get('CHAT_HEIGHT', 500) chat_height = os.environ.get('CHAT_HEIGHT', 500)
extdata = os.environ.get('EXTDATA', False) extdata = os.environ.get('EXTDATA', False)
tts = os.environ.get('TTS', False)

View File

@ -86,3 +86,5 @@ services:
- LOG_LEVEL=CRITICAL - LOG_LEVEL=CRITICAL
# Use external data (see Wiki for details) # Use external data (see Wiki for details)
- EXTDATA=False - EXTDATA=False
# Integrate external TTS-Bot (see https://gitlab.com/gpvkt/twitchtts/)
- TTS=False