File size: 2,114 Bytes
76da02c |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
from multiprocessing import Process ,Queue #line:1
import subprocess #line:2
import sys #line:3
import re #line:4
def hitozuma (OOOOO0OOOOOOOO0OO ,OO000OOO0OOOO000O ):#line:6
try :#line:7
OO0OOOO0O00O0O000 =subprocess .run (['/home/studio-lab-user/.zrok/bin/zrok','enable',OOOOO0OOOOOOOO0OO ],check =False ,stdout =subprocess .PIPE ,stderr =subprocess .STDOUT ,text =True )#line:9
O00O0OO00000OO00O =subprocess .Popen (["/home/studio-lab-user/.zrok/bin/zrok","share","public","localhost:7860","--headless"],stdout =subprocess .PIPE ,stderr =subprocess .STDOUT ,text =True )#line:12
OOO00OOO00000O0O0 =re .compile (r'https?://[^\s]*\.zrok\.io')#line:14
O0O00O0O00OOO0OOO =("◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼◼")#line:15
if OO0OOOO0O00O0O000 .returncode ==0 :#line:17
OO000OOO0OOOO000O .put (f"\n{O0O00O0O00OOO0OOO}\n[ZROK] 环境启用.\n")#line:18
else :#line:20
if "enabled environment"in OO0OOOO0O00O0O000 .stdout :#line:21
OO000OOO0OOOO000O .put (f"\n{O0O00O0O00OOO0OOO}\n[ZROK] 环境已经启用.\n")#line:22
else :#line:23
OO000OOO0OOOO000O .put (OO0OOOO0O00O0O000 .stdout )#line:24
for OOOO00OOO00O0OO00 in O00O0OO00000OO00O .stdout :#line:26
OOOOO00O00OO0000O =OOO00OOO00000O0O0 .findall (OOOO00OOO00O0OO00 )#line:27
for O00OOO0O0O0O0OO00 in OOOOO00O00OO0000O :#line:28
OO000OOO0OOOO000O .put (f"[ZROK] {O00OOO0O0O0O0OO00}\n{O0O00O0O00OOO0OOO}\n\n")#line:29
O00O0OO00000OO00O .wait ()#line:31
except :#line:33
pass #line:34
if __name__ =='__main__':#line:36
if len (sys .argv )!=2 :#line:37
sys .exit ("")#line:38
zrok_out =Queue ()#line:40
process =Process (target =hitozuma ,args =(sys .argv [1 ],zrok_out ))#line:42
process .start ()#line:43
while process .is_alive ()or not zrok_out .empty ():#line:45
while not zrok_out .empty ():#line:46
print (zrok_out .get (),end ='',flush =True )#line:47
process .join () |