From 011cde3280f5f58ce7a62557fac250fa8ffc10cf Mon Sep 17 00:00:00 2001 From: Believethehype <1097224+believethehype@users.noreply.github.com> Date: Thu, 27 Jun 2024 14:46:05 +0200 Subject: [PATCH] add voice flag --- nostr_dvm/dvm.py | 2 +- nostr_dvm/tasks/texttospeech.py | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/nostr_dvm/dvm.py b/nostr_dvm/dvm.py index 0d2661d..5d963d6 100644 --- a/nostr_dvm/dvm.py +++ b/nostr_dvm/dvm.py @@ -267,7 +267,7 @@ class DVM: else: # If there is no bid, just request server rate from user print( - "[" + self.dvm_config.NIP89.NAME + "] Requesting payment for Event: " + + "[" + self.dvm_config.NIP89.NAME + "] Requesting payment for Event: " + nip90_event.id().to_hex()) await send_job_status_reaction(nip90_event, "payment-required", False, int(amount), client=self.client, diff --git a/nostr_dvm/tasks/texttospeech.py b/nostr_dvm/tasks/texttospeech.py index e6a24ff..460ac3f 100644 --- a/nostr_dvm/tasks/texttospeech.py +++ b/nostr_dvm/tasks/texttospeech.py @@ -65,10 +65,8 @@ class TextToSpeech(DVMTaskInterface): if self.options.get("input_file") and self.options.get("input_file") != "": input_file = self.options['input_file'] else: - if not Path.exists(Path('cache/input.wav')): - input_file_url = "https://media.nostr.build/av/de104e3260be636533a56fd4468b905c1eb22b226143a997aa936b011122af8a.wav" - urllib.request.urlretrieve(input_file_url, "cache/input.wav") input_file = "cache/input.wav" + language = "en" for tag in event.tags(): @@ -92,6 +90,13 @@ class TextToSpeech(DVMTaskInterface): param = tag.as_vec()[1] if param == "language": # check for param type language = tag.as_vec()[2] + elif param == "voice": # check for param type + input_file = "cache/" + tag.as_vec()[2] + ".wav" + + if not Path.exists(Path(input_file)): + input_file_url = "https://media.nostr.build/av/de104e3260be636533a56fd4468b905c1eb22b226143a997aa936b011122af8a.wav" + urllib.request.urlretrieve(input_file_url, "cache/input.wav") + input_file = "cache/input.wav" options = { "prompt": prompt,