Fix problem

Remove code comments
This commit is contained in:
tretrauit 2022-02-05 14:29:47 +07:00
parent 93e735f260
commit d3866c2f40
No known key found for this signature in database
GPG Key ID: 862760FF1903319E

View File

@ -1,7 +1,7 @@
#!/usr/bin/python3
# Rewrite
import subprocess
import os
import json
import time
import threading
import random
@ -153,15 +153,7 @@ def main():
ws_scrcpy_thread = threading.Thread(target=print_ws_scrcpy)
ws_scrcpy_thread.daemon = True
ws_scrcpy_thread.start()
# print("starting scrcpy server on local device...")
# scrcpy = subprocess.Popen("adb shell su -c 'CLASSPATH=/data/data/com.termux/files/home/ws-scrcpy/vendor/Genymobile/scrcpy/scrcpy-server.jar app_process / com.genymobile.scrcpy.Server 1.19-ws2 web ERROR 8886'",
# shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
# def print_scrcpy():
# for line in scrcpy.stdout:
# print("[scrcpy patch]:", line.decode("utf-8").strip())
# scrcpy_thread = threading.Thread(target=print_scrcpy)
# scrcpy_thread.daemon = True
# scrcpy_thread.start()
print("PLEASE WAIT UNTIL WS-SCRCPY FULLY STARTS (ABOUT 5 MINS), IT TAKES A WHILE TO START THE SERVER.")
try:
while True:
@ -207,28 +199,6 @@ def main():
print("ws_scrcpy doesn't exit after 15 seconds, killing process...")
ws_scrcpy.kill()
# print("stopping scrcpy server...")
# if scrcpy.poll() == None:
# scrcpy.terminate()
# try:
# # if this returns, the process completed
# scrcpy.wait(timeout=15)
# except subprocess.TimeoutExpired:
# print("scrcpy doesn't exit after 15 seconds, killing process...")
# scrcpy.kill()
# # kill old scrcpy-server to ensure we can start a new one after this.
# try:
# lsof_output = subprocess.check_output(["sudo", "lsof", "-i", "-P", "-n"]).decode("utf-8")
# for line in lsof_output.split("\n"):
# if "8886" in line and "(LISTEN)" in line:
# line = ' '.join(line.split())
# print(line.strip())
# pid = line.strip().split(" ")[1]
# subprocess.call(["sudo", "kill", "-9", pid])
# break
# except:
# print("failed to stop scrcpy server")
print("ws-scrcpy has been stopped.")
show_notification("ws-scrcpy has been stopped.", ongoing=False)