Merge pull request 'sunshine: improve launching of pairing' (#1021) from a-kenji-sunshine/improve-accept into main
This commit is contained in:
@@ -155,7 +155,7 @@ in
|
|||||||
startLimitBurst = 5;
|
startLimitBurst = 5;
|
||||||
startLimitIntervalSec = 500;
|
startLimitIntervalSec = 500;
|
||||||
script = ''
|
script = ''
|
||||||
${lib.getExe pkgs.sunshine} --creds sunshine sunshine
|
${lib.getExe pkgs.sunshine} ${sunshineConfiguration} --creds sunshine sunshine
|
||||||
'';
|
'';
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
tea-create-pr = pkgs.callPackage ./tea-create-pr { };
|
tea-create-pr = pkgs.callPackage ./tea-create-pr { };
|
||||||
zerotier-members = pkgs.callPackage ./zerotier-members { };
|
zerotier-members = pkgs.callPackage ./zerotier-members { };
|
||||||
zt-tcp-relay = pkgs.callPackage ./zt-tcp-relay { };
|
zt-tcp-relay = pkgs.callPackage ./zt-tcp-relay { };
|
||||||
|
moonlight-sunshine-accept = pkgs.callPackage ./moonlight-sunshine-accept { };
|
||||||
merge-after-ci = pkgs.callPackage ./merge-after-ci { inherit (config.packages) tea-create-pr; };
|
merge-after-ci = pkgs.callPackage ./merge-after-ci { inherit (config.packages) tea-create-pr; };
|
||||||
pending-reviews = pkgs.callPackage ./pending-reviews { };
|
pending-reviews = pkgs.callPackage ./pending-reviews { };
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,18 +10,19 @@ class MoonlightPairing:
|
|||||||
self.found = threading.Event()
|
self.found = threading.Event()
|
||||||
|
|
||||||
def init_pairing(self, host: str, pin: str) -> bool:
|
def init_pairing(self, host: str, pin: str) -> bool:
|
||||||
|
# host = f"[{host}]"
|
||||||
args = ["moonlight", "pair", host, "--pin", pin]
|
args = ["moonlight", "pair", host, "--pin", pin]
|
||||||
print("Trying to pair")
|
print("Trying to pair")
|
||||||
try:
|
try:
|
||||||
self.process = subprocess.Popen(
|
print(f"Running command: {args}")
|
||||||
args, stderr=subprocess.PIPE, stdout=subprocess.PIPE
|
self.process = subprocess.Popen(args, stdout=subprocess.PIPE)
|
||||||
)
|
|
||||||
print("Pairing initiated")
|
print("Pairing initiated")
|
||||||
thread = threading.Thread(
|
thread = threading.Thread(
|
||||||
target=self.stream_output,
|
target=self.stream_output,
|
||||||
args=('Latest supported GFE server: "99.99.99.99"',),
|
args=('Latest supported GFE server: "99.99.99.99"',),
|
||||||
)
|
)
|
||||||
thread.start()
|
thread.start()
|
||||||
|
print("Thread started")
|
||||||
return True
|
return True
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(
|
print(
|
||||||
@@ -51,6 +52,8 @@ class MoonlightPairing:
|
|||||||
self.found.set()
|
self.found.set()
|
||||||
break
|
break
|
||||||
|
|
||||||
def wait_until_started(self) -> None:
|
def wait_until_started(self, timeout: int = 10) -> None:
|
||||||
self.found.wait()
|
if self.found.wait(timeout):
|
||||||
print("Started up.")
|
print("Started up.")
|
||||||
|
else:
|
||||||
|
print("Starting up took took too long. Terminated the process.")
|
||||||
|
|||||||
Reference in New Issue
Block a user