From bd2fed26b018e0b16f177ff19e6dedfb94960d89 Mon Sep 17 00:00:00 2001 From: stickman89 Date: Mon, 21 Dec 2020 16:17:42 +0000 Subject: [PATCH] Periodically flush whilst moonlight pairing process is alive; as 'expect_unbuffer' is not included in Kodi by default. --- .../lib/nvhttp/pairingmanager/simplepairingmanager.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/script.luna/resources/lib/nvhttp/pairingmanager/simplepairingmanager.py b/script.luna/resources/lib/nvhttp/pairingmanager/simplepairingmanager.py index 9410f48..930d601 100644 --- a/script.luna/resources/lib/nvhttp/pairingmanager/simplepairingmanager.py +++ b/script.luna/resources/lib/nvhttp/pairingmanager/simplepairingmanager.py @@ -2,6 +2,7 @@ import subprocess import threading import os +import sys import xbmc from resources.lib.di.requiredfeature import RequiredFeature @@ -16,7 +17,7 @@ def __init__(self, crypto_provider): def pair(self, nvhttp, server_info, dialog): self.logger.info('[MoonlightHelper] - Attempting to pair host: ' + self.config_helper.host_ip) - pairing_proc = subprocess.Popen(["expect_unbuffer", "moonlight", "pair"], cwd="/storage/moonlight", env={'LD_LIBRARY_PATH': '/storage/moonlight'}, shell=False, stdout=subprocess.PIPE, preexec_fn=os.setsid) + pairing_proc = subprocess.Popen(["moonlight", "pair"], cwd="/storage/moonlight", env={'LD_LIBRARY_PATH': '/storage/moonlight'}, shell=False, stdout=subprocess.PIPE, preexec_fn=os.setsid) lines_iterator = iter(pairing_proc.stdout.readline, b"") pairing_thread = threading.Thread(target=self.loop_lines, args=(self.logger, lines_iterator, dialog)) @@ -24,6 +25,7 @@ def pair(self, nvhttp, server_info, dialog): while True: xbmc.sleep(1000) + sys.stdout.flush() if not pairing_thread.isAlive(): break