mirror of
https://github.com/believethehype/nostrdvm.git
synced 2025-09-21 21:51:28 +02:00
Don't check length on multiple event input (speed up)
This commit is contained in:
@@ -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..")
|
# print("[" + dvm_config.NIP89.NAME + "] Getting Duration of the Media file..")
|
||||||
input_value = ""
|
input_value = ""
|
||||||
input_type = ""
|
input_type = ""
|
||||||
|
count = 0
|
||||||
for tag in event.tags():
|
for tag in event.tags():
|
||||||
if tag.as_vec()[0] == 'i':
|
if tag.as_vec()[0] == 'i':
|
||||||
input_value = tag.as_vec()[1]
|
input_value = tag.as_vec()[1]
|
||||||
input_type = tag.as_vec()[2]
|
input_type = tag.as_vec()[2]
|
||||||
|
count = count+1
|
||||||
|
|
||||||
if input_type == "text":
|
if input_type == "text":
|
||||||
return len(input_value)
|
return len(input_value)
|
||||||
|
|
||||||
if input_type == "event": # NIP94 event
|
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)
|
evt = 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)
|
||||||
|
Reference in New Issue
Block a user