added a global cache directory, not fully properly implemented, and dose not respect t.ex the FreeDesktop specifications for cache directories and files OPS this is a partial commit! things might not add up on this commit.
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
CONTAINER_ID = "c25df4d642bdeff0e0b4c4e72138c7b17db09cf174c7e5448538c6811ee10064"
|
||||
|
||||
import socket
|
||||
import json
|
||||
import builtins
|
||||
|
||||
HOST = "host.docker.internal"
|
||||
PORT = 6050
|
||||
|
||||
def connect(data):
|
||||
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
|
||||
s.connect((HOST, PORT))
|
||||
data = data + "\n"
|
||||
s.sendall(data.encode("utf-8"))
|
||||
responce = s.recv(4096)
|
||||
return responce.decode("utf-8")
|
||||
|
||||
def print_output(text):
|
||||
data = {"function": "print_output", "container_id": CONTAINER_ID, "text": text}
|
||||
connect(json.dumps(data))
|
||||
|
||||
def _neurodock_print(*args, **kwargs):
|
||||
text = " ".join(str(a) for a in args)
|
||||
print_output(text)
|
||||
|
||||
builtins.print = _neurodock_print
|
||||
|
||||
## Following is the generated
|
||||
def read_file(file_path=None):
|
||||
data = {"function":"read_file","arguments":[{"name": "file_path", "value": file_path}]}
|
||||
return json.loads(connect(json.dumps(data)))
|
||||
|
||||
def add_memory(memory, identity):
|
||||
data = {"function":"add_memory","arguments":[{"name": "memory", "value": memory}, {"name": "identity", "value": identity}]}
|
||||
return json.loads(connect(json.dumps(data)))
|
||||
|
||||
def remove_memory(identity):
|
||||
data = {"function":"remove_memory","arguments":[{"name": "identity", "value": identity}]}
|
||||
return json.loads(connect(json.dumps(data)))
|
||||
|
||||
def get_memory(identity):
|
||||
data = {"function":"get_memory","arguments":[{"name": "identity", "value": identity}]}
|
||||
return json.loads(connect(json.dumps(data)))
|
||||
|
||||
def get_memories():
|
||||
data = {"function":"get_memories"}
|
||||
return json.loads(connect(json.dumps(data)))
|
||||
|
||||
def get_memory_identities():
|
||||
data = {"function":"get_memory_identities"}
|
||||
return json.loads(connect(json.dumps(data)))
|
||||
|
||||
def get_current_date():
|
||||
data = {"function":"get_current_date"}
|
||||
return json.loads(connect(json.dumps(data)))
|
||||
|
||||
def python_runner(code=None, name=None, libs=None):
|
||||
data = {"function":"python_runner","arguments":[{"name": "code", "value": code}, {"name": "name", "value": name}, {"name": "libs", "value": libs}]}
|
||||
return json.loads(connect(json.dumps(data)))
|
||||
|
||||
def get_anime_details(id, fields=None):
|
||||
data = {"function":"get_anime_details","arguments":[{"name": "id", "value": id}, {"name": "fields", "value": fields}]}
|
||||
return json.loads(connect(json.dumps(data)))
|
||||
|
||||
def get_anime_list(offset=None, query, fields=None):
|
||||
data = {"function":"get_anime_list","arguments":[{"name": "offset", "value": offset}, {"name": "query", "value": query}, {"name": "fields", "value": fields}]}
|
||||
return json.loads(connect(json.dumps(data)))
|
||||
|
||||
def get_manag_details(id, fields=None):
|
||||
data = {"function":"get_manag_details","arguments":[{"name": "id", "value": id}, {"name": "fields", "value": fields}]}
|
||||
return json.loads(connect(json.dumps(data)))
|
||||
|
||||
def get_manga_list(offset=None, query, fields=None):
|
||||
data = {"function":"get_manga_list","arguments":[{"name": "offset", "value": offset}, {"name": "query", "value": query}, {"name": "fields", "value": fields}]}
|
||||
return json.loads(connect(json.dumps(data)))
|
||||
|
||||
def findsong(title):
|
||||
data = {"function":"findsong","arguments":[{"name": "title", "value": title}]}
|
||||
return json.loads(connect(json.dumps(data)))
|
||||
|
||||
def get_lyrics(song_id):
|
||||
data = {"function":"get_lyrics","arguments":[{"name": "song_id", "value": song_id}]}
|
||||
return json.loads(connect(json.dumps(data)))
|
||||
|
||||
def get_wiki_page_text(title):
|
||||
data = {"function":"get_wiki_page_text","arguments":[{"name": "title", "value": title}]}
|
||||
return json.loads(connect(json.dumps(data)))
|
||||
|
||||
Reference in New Issue
Block a user