diff --git a/nostr_dvm/dvm.py b/nostr_dvm/dvm.py index de0e8f6..0a8ddec 100644 --- a/nostr_dvm/dvm.py +++ b/nostr_dvm/dvm.py @@ -334,7 +334,8 @@ class DVM: user = get_or_add_user(self.dvm_config.DB, original_event.pubkey().to_hex(), client=self.client, config=self.dvm_config) print(user.lud16 + " " + str(amount)) - bolt11 = zaprequest(user.lud16, amount, "Couldn't finish job, returning sats", original_event, + bolt11 = zaprequest(user.lud16, amount, "Couldn't finish job, returning sats", + original_event, self.keys, self.dvm_config, zaptype="private") if bolt11 is None: print("Receiver has no Lightning address, can't zap back.") @@ -477,12 +478,12 @@ class DVM: python_location = "/bin/python" if platform == "win32": python_location = "/Scripts/python" - python_bin = ( r'cache/venvs/' + os.path.basename(dvm_config.SCRIPT).split(".py")[0] - + python_location) + python_bin = (r'cache/venvs/' + os.path.basename(dvm_config.SCRIPT).split(".py")[0] + + python_location) retcode = subprocess.call([python_bin, dvm_config.SCRIPT, - '--request', json.dumps(request_form), - '--identifier', dvm_config.IDENTIFIER, - '--output', 'output.txt']) + '--request', json.dumps(request_form), + '--identifier', dvm_config.IDENTIFIER, + '--output', 'output.txt']) print("Finished processing, loading data..") with open(os.path.abspath('output.txt')) as f: @@ -492,8 +493,8 @@ class DVM: if line != '\n': result += line os.remove(os.path.abspath('output.txt')) - else: #Some components might have issues with running code in otuside venv. - # We install locally in these cases for now + else: # Some components might have issues with running code in otuside venv. + # We install locally in these cases for now result = dvm.process(request_form) try: post_processed = dvm.post_process(str(result), job_event) diff --git a/nostr_dvm/tasks/texttospeech.py b/nostr_dvm/tasks/texttospeech.py index 63aea31..01f6a31 100644 --- a/nostr_dvm/tasks/texttospeech.py +++ b/nostr_dvm/tasks/texttospeech.py @@ -24,7 +24,8 @@ Outputs: Generated Audiofile class TextToSpeech(DVMTaskInterface): KIND: int = EventDefinitions.KIND_NIP90_TEXT_TO_SPEECH TASK: str = "text-to-speech" - FIX_COST: float = 200 + FIX_COST: float = 20 + PER_UNIT_COST = 0.1 dependencies = [("nostr-dvm", "nostr-dvm"), ("TTS", "TTS==0.22.0")] diff --git a/nostr_dvm/utils/mediasource_utils.py b/nostr_dvm/utils/mediasource_utils.py index 6c7d40f..797c015 100644 --- a/nostr_dvm/utils/mediasource_utils.py +++ b/nostr_dvm/utils/mediasource_utils.py @@ -20,8 +20,7 @@ def input_data_file_duration(event, dvm_config, client, start=0, end=0): input_type = tag.as_vec()[2] if input_type == "text": - # For now, ignore length of any text, just return 1. - return 1 + return len(input_value) if input_type == "event": # NIP94 event evt = get_event_by_id(input_value, client=client, config=dvm_config) @@ -29,7 +28,7 @@ def input_data_file_duration(event, dvm_config, client, start=0, end=0): input_value, input_type = check_nip94_event_for_media(evt, input_value, input_type) if input_type == "text": # For now, ingore length of any text, just return 1. - return 1 + return len(input_value) if input_type == "url": source_type = check_source_type(input_value)