Don't check length on multiple event input (speed up)

This commit is contained in:
Believethehype
2024-02-27 15:04:50 +01:00
parent ea7655e9ce
commit 4bb6721b2d

View File

@@ -14,15 +14,19 @@ def input_data_file_duration(event, dvm_config, client, start=0, end=0):
# print("[" + dvm_config.NIP89.NAME + "] Getting Duration of the Media file..")
input_value = ""
input_type = ""
count = 0
for tag in event.tags():
if tag.as_vec()[0] == 'i':
input_value = tag.as_vec()[1]
input_type = tag.as_vec()[2]
count = count+1
if input_type == "text":
return len(input_value)
if input_type == "event": # NIP94 event
if count > 1:
return 1 # we ignore length for multiple event inputs for now
evt = get_event_by_id(input_value, client=client, config=dvm_config)
if evt is not None:
input_value, input_type = check_nip94_event_for_media(evt, input_value, input_type)