55import com .amazonaws .services .polly .model .VoiceId ;
66import com .typesafe .config .Config ;
77import com .typesafe .config .ConfigFactory ;
8+ import org .slf4j .Logger ;
9+ import org .slf4j .LoggerFactory ;
10+ import org .slf4j .event .Level ;
811import simplexity .messages .Errors ;
12+ import simplexity .util .Util ;
913
1014import java .io .File ;
1115import java .util .HashMap ;
1216
1317public class TTSConfig {
1418
19+ private static final Logger logger = LoggerFactory .getLogger (TTSConfig .class );
1520 private final HashMap <String , String > replaceText = new HashMap <>();
1621 private final HashMap <String , VoiceId > voicePrefixes = new HashMap <>();
1722 private Region awsRegion ;
1823 private VoiceId defaultVoice ;
19- private String awsAccessID , awsSecretKey , twitchChannel ;
24+ private String awsAccessID , awsSecretKey , twitchChannel , twitchAppClientId , twitchAppClientSecret ;
2025 private boolean connectToTwitch ;
2126 private String twitchOAuth ;
2227 private TTSConfig (){}
@@ -86,7 +91,7 @@ private void reloadVoicePrefixes(Config config) {
8691 VoiceId voiceId = VoiceId .fromValue (String .valueOf (entry .getValue ().unwrapped ()));
8792 voicePrefixes .put (entry .getKey ().replace ("\" " , "" ), voiceId );
8893 } catch (IllegalArgumentException e ) {
89- System . out . println ( Errors .INVALID_VOICE .replace ("%voice%" , entry .getValue ().unwrapped ().toString ()));
94+ Util . logAndPrint ( logger , Errors .INVALID_VOICE .replace ("%voice%" , entry .getValue ().unwrapped ().toString ()), Level . ERROR );
9095 }
9196 });
9297 }
@@ -96,7 +101,7 @@ private void reloadRegion(Config config) {
96101 try {
97102 awsRegion = Region .getRegion (Regions .valueOf (region ));
98103 } catch (IllegalArgumentException e ) {
99- System . out . println ( Errors .INVALID_REGION .replace ("%region%" , region ));
104+ Util . logAndPrint ( logger , Errors .INVALID_REGION .replace ("%region%" , region ), Level . ERROR );
100105 awsRegion = Region .getRegion (Regions .US_EAST_1 );
101106 }
102107 }
@@ -106,7 +111,7 @@ private void reloadDefaultVoice(Config config){
106111 try {
107112 defaultVoice = VoiceId .fromValue (voiceString );
108113 } catch (IllegalArgumentException e ) {
109- System . out . println ( Errors .INVALID_DEFAULT_VOICE .replace ("%voice%" , voiceString ));
114+ Util . logAndPrint ( logger , Errors .INVALID_DEFAULT_VOICE .replace ("%voice%" , voiceString ), Level . ERROR );
110115 defaultVoice = VoiceId .Brian ;
111116 }
112117 }
@@ -115,6 +120,9 @@ private void reloadStrings(Config config){
115120 awsAccessID = config .getString ("aws-access-id" );
116121 awsSecretKey = config .getString ("aws-secret-key" );
117122 twitchChannel = config .getString ("twitch-channel" );
123+ twitchAppClientId = config .getString ("twitch-app-client-id" );
124+ twitchAppClientSecret = config .getString ("twitch-app-client-secret" );
125+
118126 }
119127
120128 private void reloadBooleans (Config config ){
@@ -140,4 +148,12 @@ public boolean isConnectToTwitch() {
140148 public String getTwitchOAuth () {
141149 return twitchOAuth ;
142150 }
151+
152+ public String getTwitchAppClientId () {
153+ return twitchAppClientId ;
154+ }
155+
156+ public String getTwitchAppClientSecret () {
157+ return twitchAppClientSecret ;
158+ }
143159}
0 commit comments