Last active 1714286842

A small script to run whenever Windows changes the numbering of my displays, to ensure that the 1080p display is always selected for streaming

aly's Avatar aly revised this gist 1714286842. Go to revision

1 file changed, 11 insertions

fixsunshine.py(file created)

@@ -0,0 +1,11 @@
1 + from requests import post
2 + from requests.exceptions import ConnectionError
3 + from subprocess import check_output
4 +
5 + dxgi = check_output(r'C:\Program Files\Sunshine\tools\dxgi-info.exe').decode("utf-8").split("\r\n")
6 + displays = dict(zip((d.split()[-1] for d in dxgi if "Resolution" in d),(d.split()[-1] for d in dxgi if "DISPLAY" in d)))
7 + post("https://localhost:47990/api/config", json={"output_name":displays["1920x1080"]}, auth=("sunshine", password), verify=False)
8 + try:
9 + post("https://localhost:47990/api/restart", auth=("sunshine", password), verify=False)
10 + except ConnectionError:
11 + pass
Newer Older