diff --git a/hugvey/speech/google.py b/hugvey/speech/google.py index 60fa481..b69e8fd 100644 --- a/hugvey/speech/google.py +++ b/hugvey/speech/google.py @@ -101,7 +101,13 @@ class GoogleVoiceClient(object): self.language_code = language_code self.isRunning.clear() self.restart = True - + + def getOfficialLangCode(self): + # October 2019: multiple versions for the French language exists, called fr-FR2 + # Instead of rewriting the whole codebase to accept a different language id, we can also + # just strip the numbers from the language code :-) + return ''.join([i for i in self.language_code if not i.isdigit()]) + def run(self): self.isRunning.set() @@ -112,7 +118,7 @@ class GoogleVoiceClient(object): config = types.RecognitionConfig( encoding=enums.RecognitionConfig.AudioEncoding.LINEAR16, sample_rate_hertz=self.src_rate, - language_code=self.language_code) + language_code=self.getOfficialLangCode()) self.streaming_config = types.StreamingRecognitionConfig( config=config, interim_results=True) diff --git a/hugvey/story.py b/hugvey/story.py index f22591a..946c576 100644 --- a/hugvey/story.py +++ b/hugvey/story.py @@ -510,7 +510,7 @@ class Condition(object): story.setVariableValue( f"stored_{self.vars['var_name']}_{i+1}", varValues[i], - store=False + store=False ) return True