diff --git a/open_dubbing/dubbing.py b/open_dubbing/dubbing.py index d0923e1..a744b3c 100644 --- a/open_dubbing/dubbing.py +++ b/open_dubbing/dubbing.py @@ -386,17 +386,6 @@ def update(self): # Update voices in case they have changed modified_utterances = utterance.get_modified_utterances(self.utterance_metadata) - assigned_voices = self.tts.assign_voices( - utterance_metadata=modified_utterances, - target_language=self.target_language, - target_language_region=self.target_language_region, - ) - - modified_utterances = self.tts.update_utterance_metadata( - utterance_metadata=modified_utterances, - assigned_voices=assigned_voices, - ) - self.tts.dub_utterances( utterance_metadata=modified_utterances, output_directory=self.output_directory, diff --git a/open_dubbing/text_to_speech.py b/open_dubbing/text_to_speech.py index 91e2659..b72be43 100644 --- a/open_dubbing/text_to_speech.py +++ b/open_dubbing/text_to_speech.py @@ -103,24 +103,6 @@ def _add_text_to_speech_properties( utterance_metadata_copy.update(voice_properties) return utterance_metadata_copy - def update_utterance_metadata( - self, - *, - utterance_metadata: Sequence[Mapping[str, str | float]], - assigned_voices: Mapping[str, str] | None, - ) -> Sequence[Mapping[str, str | float]]: - """Updates utterance metadata with assigned voices.""" - updated_utterance_metadata = [] - for metadata_item in utterance_metadata: - new_utterance = metadata_item.copy() - speaker_id = new_utterance.get("speaker_id") - new_utterance["assigned_voice"] = assigned_voices.get(speaker_id) - new_utterance = self._add_text_to_speech_properties( - utterance_metadata=new_utterance - ) - updated_utterance_metadata.append(new_utterance) - return updated_utterance_metadata - @abstractmethod def get_languages(self): pass diff --git a/open_dubbing/utterance.py b/open_dubbing/utterance.py index e53a4c6..a4d29af 100644 --- a/open_dubbing/utterance.py +++ b/open_dubbing/utterance.py @@ -187,7 +187,6 @@ def update_utterances(self, utterance_master, utterance_update): "speed", "assigned_voice", "for_dubbing", - "gender", "start", "end", ] diff --git a/tests/utterance_test.py b/tests/utterance_test.py index 3e758ab..1629b2a 100644 --- a/tests/utterance_test.py +++ b/tests/utterance_test.py @@ -221,7 +221,7 @@ def test_update_utterances_operation_update(self): { "id": 2, "operation": "update", - "gender": "Female", + "assigned_voice": "ca-ES-EnricNeural2", "translated_text": "Sóc de Tarragona", } ] @@ -236,9 +236,9 @@ def test_update_utterances_operation_update(self): "path": "output/jordi.central.edge.update/chunk_5.24534375_6.629093750000001.mp3", "text": "I am from Barcelona.", "for_dubbing": True, - "gender": "Female", + "gender": "Male", "translated_text": "Sóc de Tarragona", - "assigned_voice": "ca-ES-EnricNeural", + "assigned_voice": "ca-ES-EnricNeural2", "speed": 1.0, "dubbed_path": "output/jordi.central.edge.update/dubbed_chunk_5.24534375_6.629093750000001.mp3", "hash": "629484afdecb7641e35d686d6348cee4445611690f2f77831e892d52c3128bdd",