Nonary / PlayNiteWatcher

Configure Steam/PlayNite Games to launch and terminate with Sunshine as well as automatically end streams when a game closes.
75 stars 2 forks source link

PlayNite Watcher Script Guide

Welcome to the PlayNite Watcher script for Sunshine and Moonlight! This powerful script enables the automated addition of multiple games to Sunshine and ensures that Moonlight shuts down when you exit those games. It emulates the behavior of GeForce Experience, providing you with game names, box art, and additional details right within Moonlight once installed.

This script is also perfect for users who prefer the "Big Picture Mode" or FullScreen mode in PlayNite. It conveniently closes games launched in FullScreen mode upon exit, maintaining the same streamlined experience.

Why the script is necessary

Many games launch through unique launchers that initiate separate processes. As a result, these games are often added as "detached" commands, which Sunshine and Moonlight can't monitor to close the stream automatically. This script is designed to overcome that hurdle, enabling virtually any game to launch without sacrificing auto-close functionality.

Furthermore, the script is a great asset for those seeking to streamline their big picture mode experience.

In short, this script enhances PlayNite by running games as "commands," thus allowing Sunshine to recognize when a game is closed.

Caveats:

Prerequisites

Before you begin, ensure:

Setup Instructions

Note: This script automatically adds Playnite's fullscreen mode to Sunshine, so you don't need to manually add every game—just focus on your favorites.

  1. Open PlayNite: Launch the PlayNite application on your computer.
  2. Download the Extension: Visit the Playnite Add-ons page and download the "Sunshine App Export" extension. When prompted, open the extension in PlayNite.
  3. Restart PlayNite: Follow the on-screen instructions to restart PlayNite and proceed to the next steps.
  4. Select Games to Export: In PlayNite, select the games you want to export to Sunshine.
  5. Export Games:
    • Click on "Controller" in the top-left corner.
    • Navigate to "Extensions" -> "Sunshine App Export" -> "Export selected games."
  6. Specify Sunshine Path: If the installation path for Sunshine has changed, click "Browse" to locate it. If the path is correct, click "Export Games." Confirm the User Account Control (UAC) prompt that appears.
  7. Run the Installer: Double-click "Installer.bat" and accept the UAC prompt to continue.
  8. Handle Configuration Errors: If a configuration error occurs, follow any additional instructions provided.
  9. Finalize Setup: Click "Install" to complete the setup process. This will terminate any existing Moonlight sessions and restart PlayNite.

Important Notes:

Troubleshooting

If you encounter any issues with the PlayNite Watcher script, follow these steps:

  1. Review Setup Instructions: Double-check the setup instructions to ensure all steps were completed correctly.
  2. Verify Prerequisites: Confirm that all required prerequisites are installed and properly configured.
  3. Update Sunshine: Ensure that Sunshine is updated to at least version 0.20.

Export Issues: Not All Games Are Exported

The export feature only works for games with downloaded metadata. If you have added games manually (e.g., via scanning or manual entry), ensure that you download all necessary metadata for those games. To download metadata in Playnite:

  1. Right-click the game in Playnite.
  2. Select "Edit."
  3. Click the "Download Metadata" button.
  4. Choose "IGDB," select the correct game name, and follow the on-screen instructions to import all available data.

Tip: You can automate metadata downloads for all games by clicking the Playnite menu button and selecting "Download Metadata" (or press Control + D).

Session Not Terminating When Closing a Game

If the script doesn’t terminate the session when you close a game, it may be due to the script being saved in a location that requires administrator rights. This script does not run in administrator mode. To resolve this:

If these steps don’t resolve your issues, seek further support on the Sunshine or Moonlight Discord channels. You can also contact the script creator, demon.cat, for additional help.