Permalink
Browse files

update how the custom tts thing worked

it now requires a custom TTS url as well
  • Loading branch information...
1 parent bed1628 commit 9f7dd18b63b7a1728b24e7ec3288028af50a5db2 @pajlada committed Dec 23, 2016
Showing with 9 additions and 2 deletions.
  1. +4 −1 pajbot/web/routes/clr.py
  2. +4 −1 static/scripts/clr.donations.js
  3. +1 −0 templates/clr/donations.html
@@ -62,8 +62,10 @@ def donations(widget_id, **options):
widget['conditions'].sort(key=lambda c: (operator_order[c['operator']], c['amount']))
tts_authentication = ''
+ tts_endpoint = ''
if 'extra' in config:
tts_authentication = config['extra'].get('tts_authentication', '')
+ tts_endpoint = config['extra'].get('tts_endpoint', '')
redis = RedisManager.get()
twitch_emotes = redis.hgetall('global:emotes:twitch')
@@ -83,4 +85,5 @@ def donations(widget_id, **options):
return render_template('clr/donations.html',
widget=widget,
emotes=emotes,
- tts_authentication=tts_authentication)
+ tts_authentication=tts_authentication,
+ tts_endpoint=tts_endpoint)
@@ -100,12 +100,15 @@ var tts_sound = null;
function tts_message(message)
{
+ if (tts_endpoint == '') {
+ return;
+ }
var voice = 'en-US_LisaVoice';
var voice = 'en-GB_KateVoice';
var voice = 'en-US_AllisonVoice';
message = message.replace(new RegExp('#', 'g'), 'hashtag');
message = message.replace(new RegExp('<3', 'g'), ' love ');
- var tts_url = 'https://hosted.stylerdev.io/api/synthesize?voice=' + voice + '&text=' + encodeURI(message) + '&token=' + tts_authorization;
+ var tts_url = tts_endpoint + '?voice=' + voice + '&text=' + encodeURI(message) + '&token=' + tts_authorization;
tts_sound = new Audio();
tts_sound.addEventListener('playing', function() {
@@ -245,6 +245,7 @@
streamer = '{{ streamer.full_name }}';
var timer = false;
tts_authorization = '{{ tts_authentication }}';
+tts_endpoint = '{{ tts_endpoint }}';
var use_tts = {{ 'true' if widget.tts else 'false' }};
var widget_type = '{{ widget.widget_type if widget.widget_type else 'split' }}';

0 comments on commit 9f7dd18

Please sign in to comment.