Skip to content

Commit

Permalink
Check for Sunshine installation.
Browse files Browse the repository at this point in the history
- Add function to detect if Sunshine is installed (native or Flatpak)
- Warn user if Sunshine is not installed
- Inform user that Sunshine Flatpak is not supported
  • Loading branch information
Arbitrate3280 committed Jul 3, 2024
1 parent ca52264 commit 2f1d3e2
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions lutristosunshine.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,17 @@ def run_command(cmd: str) -> subprocess.CompletedProcess:
"""Run a shell command and return the result."""
return subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)

def detect_sunshine_installation() -> Tuple[bool, str]:
"""Detect if Sunshine is installed and how."""
# Check for Flatpak installation
if run_command("flatpak list | grep dev.lizardbyte.app.Sunshine").returncode == 0:
return True, "flatpak"
# Check for native installation
elif run_command("which sunshine").returncode == 0:
return True, "native"
else:
return False, ""

def get_lutris_command(args: str = "") -> Optional[str]:
"""Get the appropriate Lutris command based on installation type."""
# Check for Flatpak installation
Expand Down Expand Up @@ -334,6 +345,14 @@ def add_game_to_sunshine(sunshine_data: Dict, game_id: str, game_name: str, imag

def main():
try:
sunshine_installed, installation_type = detect_sunshine_installation()
if not sunshine_installed:
print("Error: No Sunshine installation detected.")
return
if installation_type == "flatpak":
print("Warning: Sunshine Flatpak is not supported. Please use the native installation of Sunshine.")
return

lutris_command = get_lutris_command()
heroic_command, _ = get_heroic_command()

Expand Down

0 comments on commit 2f1d3e2

Please sign in to comment.