Retroarch / OBS Scripts
Scripts to assist in updating OBS with data regarding the current game playing in Retroarch.How it works
When you run a game in Retroarch content_history.lpl is updated with JSON describing some data about the state including the game run, and the items that have the last game inserted into record 0. The code grabs that and attempts to parse the information. The core is extracted to try to convert it into a folder structure that we then look for a boxart folder if existing, if not it attempts to grab the first matching file, then it tries to remove any (USA) identifiers and make a match against that, otherwise it attempts to set the default value.This image is then copied to an image directory that the user would need to point OBS to, and display as an IMAGE. I recommend trying to set the image as a fixed value to avoid spam.
OBS Setting
Edit the Transform for the image with the following properties:Positional Alignment
Top LeftBounding Box Type
Scale to inner boundsThen set the size and so forth however you like and it should remain static.
Usage
Currently, things are fairly opinionated as trying to get things working locally. Most of the directories are located at the top of whatson.py and the subfolder decoration is currently in playing.pyNOTE: You need to play a default.png in the root directory of the art folder in case no good match can be made. Otherwise, it will not change the image at all.
Entry Code - whatson.py
python whatson.pyFuture Goals
More Metadata
I want to feed the actual core data and so fort to the output folder as well, this shouldn't be hard to perhaps provide additional metadata such as titles, game names, cores, etc to the able to be consumed by external apps.Web Queries
Query DB for additional data on the title to inject into the outputWeb-based images
Webhooks
Make a call to a discord webhook for example to announce what's playing with the image data.Thanks:
Inspired by the work done by marcomalachias: https://obsproject.com/forum/threads/obs-retroarch-watchdog.127058/