mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
feat(glob,nk): old files/dirs remove
This commit is contained in:
parent
083d184250
commit
a22ca26655
17 changed files with 0 additions and 940 deletions
|
|
@ -1,54 +0,0 @@
|
|||
'''
|
||||
Simple socket server using threads
|
||||
'''
|
||||
|
||||
import socket
|
||||
import sys
|
||||
import threading
|
||||
import StringIO
|
||||
import contextlib
|
||||
|
||||
import nuke
|
||||
|
||||
HOST = ''
|
||||
PORT = 8888
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
def stdoutIO(stdout=None):
|
||||
old = sys.stdout
|
||||
if stdout is None:
|
||||
stdout = StringIO.StringIO()
|
||||
sys.stdout = stdout
|
||||
yield stdout
|
||||
sys.stdout = old
|
||||
|
||||
|
||||
def _exec(data):
|
||||
with stdoutIO() as s:
|
||||
exec(data)
|
||||
return s.getvalue()
|
||||
|
||||
|
||||
def server_start():
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
s.bind((HOST, PORT))
|
||||
s.listen(5)
|
||||
|
||||
while 1:
|
||||
client, address = s.accept()
|
||||
try:
|
||||
data = client.recv(4096)
|
||||
if data:
|
||||
result = nuke.executeInMainThreadWithResult(_exec, args=(data))
|
||||
client.send(str(result))
|
||||
except SystemExit:
|
||||
result = self.encode('SERVER: Shutting down...')
|
||||
client.send(str(result))
|
||||
raise
|
||||
finally:
|
||||
client.close()
|
||||
|
||||
t = threading.Thread(None, server_start)
|
||||
t.setDaemon(True)
|
||||
t.start()
|
||||
|
|
@ -1,6 +1,5 @@
|
|||
import os
|
||||
import sys
|
||||
import atom_server
|
||||
import KnobScripter
|
||||
|
||||
from pype.nuke.lib import (
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue