diff options
Diffstat (limited to 'scripts/sockets.py')
| -rw-r--r-- | scripts/sockets.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/scripts/sockets.py b/scripts/sockets.py new file mode 100644 index 0000000..802d5e6 --- /dev/null +++ b/scripts/sockets.py @@ -0,0 +1,32 @@ +import socket +import time +import os + +cmd1 = """ +{"action":"add","identifier":"preview","max_height":21,"max_width":118,"path":"/tmp/a.png","x":10,"y":15} +""" + +cmd2 = """ +{"action":"add","identifier":"preview","max_height":47,"max_width":118,"path":"/tmp/b.png","x":10,"y":15} +""" + +cmd_exit = """ +{"action":"remove","identifier":"preview"} +""" + +s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM) +connected = False +while not connected: + try: + s.connect(f"/tmp/ueberzugpp-30468.socket") + connected = True + except Exception: + time.sleep(0.05) + +s.sendall(str.encode(cmd1 + "\n")) +time.sleep(2) +s.sendall(str.encode(cmd_exit + "\n")) +s.sendall(str.encode(cmd2 + "\n")) +time.sleep(2) +s.sendall(str.encode(cmd_exit + "\n")) +s.close() |
