-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
for fix AndreMiras/pycaw#85
- Loading branch information
erivieccio
committed
Sep 3, 2024
1 parent
a6d0b2f
commit 874b772
Showing
3 changed files
with
63 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# --------------------------------------------------------------------------------------- | ||
# Project: BusyLight Windows Client - Runner Script | ||
# Author: Evaristo R. Rivieccio Vega - SysAdmin | ||
# GitHub: https://github.com/evaristorivi | ||
# LinkedIn: https://www.linkedin.com/in/evaristorivieccio/ | ||
# Web: https://www.evaristorivieccio.es/ | ||
# --------------------------------------------------------------------------------------- | ||
# Description: | ||
# This Python script is a runner for the BusyLight Windows Client. It is designed to | ||
# ensure that the main script, mic-in-use-windows.py, continues to run indefinitely by | ||
# restarting it if it closes unexpectedly. | ||
# | ||
# The main script monitors the status of audio sessions in real-time and sends signals | ||
# to the BusyLight API to control the LED strip based on whether the microphone is in use | ||
# or not. | ||
# | ||
# The runner script is responsible for: | ||
# - Launching the main script. | ||
# - Detecting if the main script terminates. | ||
# - Restarting the main script if it exits. | ||
# | ||
# Usage: | ||
# Run this script to ensure that the BusyLight client script is always running. | ||
# | ||
# --------------------------------------------------------------------------------------- | ||
|
||
import subprocess | ||
import time | ||
import os | ||
import sys | ||
|
||
def run_script(): | ||
print("The service is running. You can minimise this window.") | ||
script_path = os.path.join(os.path.dirname(__file__), 'mic-in-use-windows.py') | ||
|
||
process = subprocess.Popen([sys.executable, script_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE) | ||
|
||
while True: | ||
exit_code = process.wait() | ||
|
||
# stdout, stderr = process.communicate() | ||
# if stdout: | ||
# print(stdout.decode()) | ||
# if stderr: | ||
# print(stderr.decode()) | ||
|
||
time.sleep(1) | ||
process = subprocess.Popen([sys.executable, script_path], stdout=subprocess.PIPE, stderr=subprocess.PIPE) | ||
|
||
if __name__ == "__main__": | ||
run_script() |