Update create_wait_kill_all.py
This commit is contained in:
parent
184f520994
commit
ecc3950e54
@ -151,33 +151,36 @@ if __name__ == '__main__':
|
|||||||
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
|
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
|
||||||
|
|
||||||
response = fetch('status/sessions')
|
response = fetch('status/sessions')
|
||||||
|
fileDir = fileDir = os.path.dirname(os.path.realpath(__file__))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if find_sessionID(response):
|
if find_sessionID(response):
|
||||||
stream_info = find_sessionID(response)
|
stream_info = find_sessionID(response)
|
||||||
file_name = "{}.py".format(stream_info[0])
|
file_name = "{}.py".format(stream_info[0])
|
||||||
file = 'from time import sleep\n' \
|
full_path = os.path.join(fileDir, file_name)
|
||||||
'import sys, os\n' \
|
file = "from time import sleep\n" \
|
||||||
'from {script} import kill_stream \n' \
|
"import sys, os\n" \
|
||||||
'message = "{REASON}"\n' \
|
"from {script} import kill_stream \n" \
|
||||||
'sessionID = os.path.basename(sys.argv[0])[:-3]\n' \
|
"message = '{REASON}'\n" \
|
||||||
'x = 0\n' \
|
"sessionID = os.path.basename(sys.argv[0])[:-3]\n" \
|
||||||
'n = {ntime}\n' \
|
"x = 0\n" \
|
||||||
'try:\n' \
|
"n = {ntime}\n" \
|
||||||
' while x < n and x is not None:\n' \
|
"try:\n" \
|
||||||
' sleep({xtime})\n' \
|
" while x < n and x is not None:\n" \
|
||||||
' x += kill_stream(sessionID, message, {xtime}, n, "{user}", "{title}", "{sess_key}")\n' \
|
" sleep({xtime})\n" \
|
||||||
' kill_stream(sessionID, message, {ntime}, n, "{user}", "{title}", "{sess_key}")\n' \
|
" x += kill_stream(sessionID, message, {xtime}, n, '{user}', '{title}', '{sess_key}')\n" \
|
||||||
' os.remove(sys.argv[0])\n' \
|
" kill_stream(sessionID, message, {ntime}, n, '{user}', '{title}', '{sess_key}')\n" \
|
||||||
'except TypeError as e:\n' \
|
" os.remove(sys.argv[0])\n" \
|
||||||
' os.remove(sys.argv[0])'.format(script=os.path.basename(__file__)[:-3],
|
"except TypeError as e:\n" \
|
||||||
ntime=TIMEOUT, xtime=INTERVAL, REASON=REASON,
|
" os.remove(sys.argv[0])".format(script=os.path.basename(__file__)[:-3],
|
||||||
user=stream_info[1], title=stream_info[2], sess_key=stream_info[3])
|
ntime=TIMEOUT, xtime=INTERVAL, REASON=REASON,
|
||||||
|
user=stream_info[1], title=stream_info[2],
|
||||||
|
sess_key=stream_info[3])
|
||||||
|
|
||||||
with open(file_name, "w+") as output:
|
with open(full_path, "w+") as output:
|
||||||
output.write(file)
|
output.write(file)
|
||||||
|
|
||||||
subprocess.Popen([sys.executable, file_name], startupinfo=startupinfo)
|
subprocess.Popen([sys.executable, full_path], startupinfo=startupinfo)
|
||||||
exit(0)
|
exit(0)
|
||||||
|
|
||||||
except TypeError as e:
|
except TypeError as e:
|
||||||
|
Loading…
Reference in New Issue
Block a user