UPDATE! - MiSTer Streaming Script (OBS/SLOBS)

Discussion of developmental aspects of the MiSTer Project.
User avatar
ItalianGrandma
Posts: 54
Joined: Sun May 24, 2020 7:09 pm
Has thanked: 1 time
Been thanked: 4 times

UPDATE! - MiSTer Streaming Script (OBS/SLOBS)

Unread post by ItalianGrandma »

Update 5/10/21:

The script is alive!! :D

An awesome dev in the MiSTer community was kind enough to work with me on this and bring the script to life!

It’s a great tool for streamers that want to show the name of the game and console you are playing without having to do manual updates :)

Go here to check it out: https://github.com/christopher-roelofs/misterobs

If you want to see an example of it in action, go here: https://www.twitch.tv/videos/1000421906


- - - - - - - - - - - - - - - - - - - -


Obligatory NOT A DEV :D

I just wanted to know if something like this is feasible...a script that runs on a PC and "listens" and logs things from a MiSTer connected to the same network.

Use Case: I stream on Twitch using the MiSTer and I'd love to have a way to change a specific text file on my PC when switching Game/Core on the MiSTer. This would be a way to automatically change a game title in my OBS overlay when switching games/cores on the MiSTer

1) Change game on MiSTer
2) Listener script grabs file name and core name
3) Script writes file name and core name to C:\gametitle.txt
Bas
Posts: 101
Joined: Fri Jan 22, 2021 4:36 pm
Has thanked: 8 times
Been thanked: 32 times

Re: MiSTer "Listener" Script on PC (Feasible?)

Unread post by Bas »

The Prometheus node exporter could provide a lot of groundwork for this. The other bit of the puzzle would be making MiSTer output its housekeeping to a text file. That should be doable without too much overhead. Your PC can then poll the node exporter over http.
User avatar
RealLarry
Posts: 55
Joined: Mon May 25, 2020 4:04 am
Has thanked: 5 times
Been thanked: 8 times

Re: MiSTer "Listener" Script on PC (Feasible?)

Unread post by RealLarry »

ItalianGrandma wrote: Tue Mar 30, 2021 2:42 pm Obligatory NOT A DEV :D

I just wanted to know if something like this is feasible...a script that runs on a PC and "listens" and logs things from a MiSTer connected to the same network.

Use Case: I stream on Twitch using the MiSTer and I'd love to have a way to change a specific text file on my PC when switching Game/Core on the MiSTer. This would be a way to automatically change a game title in my OBS overlay when switching games/cores on the MiSTer

1) Change game on MiSTer
2) Listener script grabs file name and core name
3) Script writes file name and core name to C:\gametitle.txt
@venice did a very similar thing to display core's title on an OLED. Very flexible code and scripts. Have a look to adapt or as a source for your own ideas.
viewtopic.php?f=9&t=1887&start=50
User avatar
aberu
Posts: 511
Joined: Tue Jun 09, 2020 8:34 pm
Location: Longmont, CO
Has thanked: 80 times
Been thanked: 112 times

Re: MiSTer "Listener" Script on PC (Feasible?)

Unread post by aberu »

https://github.com/venice1200/MiSTer_tty2oled - the repo has a lot more info btw
dentnz
Posts: 53
Joined: Sun May 24, 2020 10:28 pm
Been thanked: 10 times

Re: MiSTer "Listener" Script on PC (Feasible?)

Unread post by dentnz »

You can run the MiSTer binary and pipe it's console output to a file. You could then quite easily create a tail on that file, parsing it for keywords and performing actions from there. As cores change and roms are loaded, that information is output by the binary, so everything should be there for you to work with. Definitely use that tty2 as a basis...
User avatar
ItalianGrandma
Posts: 54
Joined: Sun May 24, 2020 7:09 pm
Has thanked: 1 time
Been thanked: 4 times

Re: MiSTer "Listener" Script on PC (Feasible?)

Unread post by ItalianGrandma »

An update!!!

An awesome guy who goes by the name Bamboozler on Discord was nice enough to work with me on this and make it a reality!!

Any streamers who are interested in giving this a whirl, get the script here: https://github.com/christopher-roelofs/misterobs
User avatar
venice
Posts: 176
Joined: Tue Jun 16, 2020 9:29 am
Location: Germany
Has thanked: 69 times
Been thanked: 56 times

Re: UPDATE! - MiSTer Streaming Script (OBS/SLOBS)

Unread post by venice »

ItalianGrandma wrote: Tue Mar 30, 2021 2:42 pm ...
The script is alive!! :D

An awesome dev in the MiSTer community was kind enough to work with me on this and bring the script to life!
Looks good :)

In total you poll using SSH for the Core/MRA/Console-Game-Name each Second (or whatever is set)?
My MiSTer Add-On Projects on Github tty2oled, i2c2oled
Donate via Post-Cardware if you like.
Panda
Posts: 3
Joined: Sun May 24, 2020 6:58 pm

Re: UPDATE! - MiSTer Streaming Script (OBS/SLOBS)

Unread post by Panda »

venice wrote: Sun Jun 06, 2021 5:53 pm
ItalianGrandma wrote: Tue Mar 30, 2021 2:42 pm ...
The script is alive!! :D

An awesome dev in the MiSTer community was kind enough to work with me on this and bring the script to life!
Looks good :)

In total you poll using SSH for the Core/MRA/Console-Game-Name each Second (or whatever is set)?
Yes. By default, it's set to 1s but you could change it in the config. So far 1s seems to work well without impacting anything so I would stick with that.
User avatar
venice
Posts: 176
Joined: Tue Jun 16, 2020 9:29 am
Location: Germany
Has thanked: 69 times
Been thanked: 56 times

Re: UPDATE! - MiSTer Streaming Script (OBS/SLOBS)

Unread post by venice »

Panda wrote: Tue Jun 08, 2021 12:05 am Yes. By default, it's set to 1s but you could change it in the config. So far 1s seems to work well without impacting anything so I would stick with that.
Ok, but how are the console loaded games identified?
Is there anything I need to do on the MISTer side before I get the information out of "get_last_game(core)" function.
I checked my files in "/media/fat/config" but I don't find anything usable.

Many Thanks
My MiSTer Add-On Projects on Github tty2oled, i2c2oled
Donate via Post-Cardware if you like.
Panda
Posts: 3
Joined: Sun May 24, 2020 6:58 pm

Re: UPDATE! - MiSTer Streaming Script (OBS/SLOBS)

Unread post by Panda »

venice wrote: Tue Jun 08, 2021 10:12 am
Panda wrote: Tue Jun 08, 2021 12:05 am Yes. By default, it's set to 1s but you could change it in the config. So far 1s seems to work well without impacting anything so I would stick with that.
Ok, but how are the console loaded games identified?
Is there anything I need to do on the MISTer side before I get the information out of "get_last_game(core)" function.
I checked my files in "/media/fat/config" but I don't find anything usable.

Many Thanks
Nope. Every second it runs the following commands via ssh:

"ps aux | grep [r]bf" - Gets the current running core
"ps aux | grep [r]bf" + check if there is an .mra file running - Gets current running mra game
'find /media/fat/config/ -mmin -{timeframe}' - Gets current running non .mra game. Basically this looks for the last touched file in the /media/fat/config/ folder and then reads the last game from the file. {timeframe} is basically 1x poll rate from the config.

It then matches the core in the cores.json file and figures out what it needs to do based on that.
User avatar
venice
Posts: 176
Joined: Tue Jun 16, 2020 9:29 am
Location: Germany
Has thanked: 69 times
Been thanked: 56 times

Re: UPDATE! - MiSTer Streaming Script (OBS/SLOBS)

Unread post by venice »

Panda wrote: Tue Jun 08, 2021 8:09 pm Nope. Every second it runs the following commands via ssh:
...
It then matches the core in the cores.json file and figures out what it needs to do based on that.
I understand :)

But if I start, from my MiSTer, for example an NES Game, I don't find anything related to NES or the loaded Game in /media/fat/config.
I looks to me nothing is written to /media/fat/config :shock:

Could you give me an example?
My MiSTer Add-On Projects on Github tty2oled, i2c2oled
Donate via Post-Cardware if you like.
Panda
Posts: 3
Joined: Sun May 24, 2020 6:58 pm

Re: UPDATE! - MiSTer Streaming Script (OBS/SLOBS)

Unread post by Panda »

venice wrote: Wed Jun 09, 2021 11:05 am
Panda wrote: Tue Jun 08, 2021 8:09 pm Nope. Every second it runs the following commands via ssh:
...
It then matches the core in the cores.json file and figures out what it needs to do based on that.
I understand :)

But if I start, from my MiSTer, for example an NES Game, I don't find anything related to NES or the loaded Game in /media/fat/config.
I looks to me nothing is written to /media/fat/config :shock:

Could you give me an example?

You should see .cfg files like GBA_recent_1.cfg, Genesis_recent_1.cfg etc. Do you have the recents setting enabled in your MiSTer.ini file?

recents=1 ; set to 1 to show recently played games
User avatar
venice
Posts: 176
Joined: Tue Jun 16, 2020 9:29 am
Location: Germany
Has thanked: 69 times
Been thanked: 56 times

Re: UPDATE! - MiSTer Streaming Script (OBS/SLOBS)

Unread post by venice »

Panda wrote: Wed Jun 09, 2021 12:00 pm You should see .cfg files like GBA_recent_1.cfg, Genesis_recent_1.cfg etc.
Nope
Panda wrote: Wed Jun 09, 2021 12:00 pm ...
Do you have the recents setting enabled in your MiSTer.ini file?
No, but now ;)
And it works perfectly.
My MiSTer Add-On Projects on Github tty2oled, i2c2oled
Donate via Post-Cardware if you like.
Post Reply