Bash script: RetroArch Attract Mode Playlist Shuffler

In my experiment, without the QUIT command I was getting a warning / error message like “kill: (196432) - No such process” sometimes when quitting. But now after your magical comment it seems to work fine. Looks like the remote QUIT command can be removed at that place.

Edit: I see. That’s some brutal naming right there and I love it. :smiley:

Main post updated with a robust parser and immediate exit on retroarch quit.

While the parser It is not fast as I imagined, it does its things in a granular way (game by game), so it does not introduce any startup delay.

Reversing the logic so the script exits as soon as RetroArch quits looks like a clean way around SIGCHLD not firing while read is blocking. Now that the parser works game by game, could the -t timeout eventually be set per playlist entry instead of one value for every game?

I’m not sure I understood.

Do you mean supporting multiple playlists with a specific timeout for each one?

(or maybe the main post is not clear, the timeout is already a single value applied to all games)

I tried the newest version of your script. And have thoughts again:

  • maybe add versioning, so if I later look into this post then I can easily compare version number to know if anything changed, this is even more important because the script has personalization changes, so comparing downloads if anything changed in an automated manner is a bit complicated
  • nice to have proper option handling now :slight_smile:
  • I would prefer not to have any banner, usually I turn stuff like this off
  • why is the last for loop enclosed in a while true loop?
  • why do you # Reformat each line to be easilly parsable. on the last for loop for every line, instead doing it once outside like you did before?

These are just some thoughts, no demand or anything like that. I really like your script now and will definitely save it.

Eheh, the script gets much more complicated than I originally planned, I agree about versioning.

As per the banner, if you set it to scroll, it will go away as playlist advances, but I can certainly add a way to hide it, if you still think it is worth.

The last reformat operates in the loop on a single line/game entry, so you don’t have to wait to process them all before. displaying the first game (it may introduce significant delay on large playlists).

Everything is enclosed in the loop so it keeps running when the playlist is done.

Any reason to not do that?

It always starts simple.

I guess extra option to disable banner is not really needed, for the sake of simplicity and not to introduce feature creep. As it scrolls away anyway, so fair enough. I usually disable banners that take space without being useful, but in this case it scrolls away and the main window is the emulator anyway.

For your last point: So it is by design to start over the playlist, once it has reached its end? Well okay if that is how it is supposed to work, then I guess it makes sense. My personal expectation was that the script ends with the last entry. Maybe add a comment as documentation for anyone reading the script and wondering why that was done.

  • I made it clearer that the loop never ends in the main post :slight_smile:
  • Version is set to 0.5 now and added a public domain license to the script
  • Now it is possible to go backward
1 Like