async function

This commit is contained in:
Believethehype
2024-06-16 01:07:47 +02:00
parent 7ee8c855a7
commit b2ad96717c
2 changed files with 3 additions and 3 deletions

View File

@@ -130,7 +130,7 @@ class DVM:
if self.dvm_config.LOGLEVEL.value >= LogLevel.INFO.value: if self.dvm_config.LOGLEVEL.value >= LogLevel.INFO.value:
print( print(
bcolors.MAGENTA + "[" + self.dvm_config.NIP89.NAME + "] Received new Request: " + task + " from " + user.name + bcolors.ENDC) bcolors.MAGENTA + "[" + self.dvm_config.NIP89.NAME + "] Received new Request: " + task + " from " + user.name + bcolors.ENDC)
duration = input_data_file_duration(nip90_event, dvm_config=self.dvm_config, client=self.client) duration = await input_data_file_duration(nip90_event, dvm_config=self.dvm_config, client=self.client)
amount = get_amount_per_task(task, self.dvm_config, duration) amount = get_amount_per_task(task, self.dvm_config, duration)
if amount is None: if amount is None:
return return

View File

@@ -11,7 +11,7 @@ from nostr_dvm.utils.scrapper.media_scrapper import OvercastDownload, XitterDown
InstagramDownload, YouTubeDownload, XDownload InstagramDownload, YouTubeDownload, XDownload
def input_data_file_duration(event, dvm_config, client, start=0, end=0): async def input_data_file_duration(event, dvm_config, client, start=0, end=0):
# print("[" + dvm_config.NIP89.NAME + "] Getting Duration of the Media file..") # print("[" + dvm_config.NIP89.NAME + "] Getting Duration of the Media file..")
input_value = "" input_value = ""
input_type = "" input_type = ""
@@ -28,7 +28,7 @@ def input_data_file_duration(event, dvm_config, client, start=0, end=0):
if input_type == "event": # NIP94 event if input_type == "event": # NIP94 event
if count > 1: if count > 1:
return 1 # we ignore length for multiple event inputs for now return 1 # we ignore length for multiple event inputs for now
evt = get_event_by_id(input_value, client=client, config=dvm_config) evt = await get_event_by_id(input_value, client=client, config=dvm_config)
if evt is not None: if evt is not None:
input_value, input_type = check_nip94_event_for_media(evt, input_value, input_type) input_value, input_type = check_nip94_event_for_media(evt, input_value, input_type)
if input_type == "text": if input_type == "text":