skip doing the job if addressed to someone else, add media converter

This commit is contained in:
Believethehype
2023-11-30 08:07:30 +01:00
parent 42b3d763f1
commit dd1b69bc0b
19 changed files with 445 additions and 201 deletions

View File

@ -7,6 +7,7 @@ from utils.admin_utils import AdminConfig
from utils.dvmconfig import DVMConfig
from utils.nip89_utils import NIP89Config
from core.dvm import DVM
from utils.output_utils import post_process_result
class DVMTaskInterface:
@ -18,6 +19,7 @@ class DVMTaskInterface:
PRIVATE_KEY: str
PUBLIC_KEY: str
DVM = DVM
SUPPORTS_ENCRYPTION = True # DVMs build with this framework support encryption, but others might not.
dvm_config: DVMConfig
admin_config: AdminConfig
@ -39,7 +41,6 @@ class DVMTaskInterface:
if task is not None:
self.TASK = task
dvm_config.SUPPORTED_DVMS = [self]
dvm_config.DB = "db/" + self.NAME + ".db"
if nip89config.KIND is not None:
@ -49,7 +50,6 @@ class DVMTaskInterface:
self.dvm_config = dvm_config
self.admin_config = admin_config
def run(self):
nostr_dvm_thread = Thread(target=self.DVM, args=[self.dvm_config, self.admin_config])
nostr_dvm_thread.start()
@ -67,8 +67,6 @@ class DVMTaskInterface:
"""Check if input is supported for current Task."""
pass
def create_request_form_from_nostr_event(self, event, client=None, dvm_config=None) -> dict:
"""Parse input into a request form that will be given to the process method"""
pass
@ -77,6 +75,11 @@ class DVMTaskInterface:
"Process the data and return the result"
pass
def post_process(self, result, event):
"""Post-process the data and return the result Use default function, if not overwritten"""
return post_process_result(result, event)
@staticmethod
def set_options(request_form):
print("Setting options...")