pi-guyParticipant03/21/2016 at 09:58Post count: 32
So, I know there is already a splash screen randomizer but this is really easy. I suppose I’m reinventing the wheel and probably badly since this will only pickup *.png files but maybe someone will find it useful.
***Beware, I’m not a Linux or RetroPie guru, I simply like to experiment – what else is the Pi for?
Works with RetroPie 3.6 image.
Drop your *.png files in the SMB share under \\HOST_IP_ADDRESS\splashscreens\ and make a backup of the file /opt/retropie/supplementary/splashscreen/retropie2015-blue/splashscreen.png
Make sure you haven’t changed the default splashscreen, if so simply change it back to default in RetroPie’s setting menu
Change your /etc/rc.local file to look like this (use sudo and your favorite text editor…of course vi)-
#!/bin/sh -e # # rc.local # # This script is executed at the end of each multiuser runlevel. # Make sure that the script will "exit 0" on success or any other # value on error. # # In order to enable or disable this script just change the execution # bits. # # By default this script does nothing. ls /home/pi/RetroPie/splashscreens/*.png |sort -R |head -1 |while read file; do cp $file /opt/retropie/supplementary/splashscreen/retropie2015-blue/splashscreen.png done exit 0
Perform a full system power-off and power-on twice
Enjoy a easily manageable retropie splashscreen randomizer
*Notes – I don’t think the “do while” loop is needed but couldn’t figure out a different way of doing it, and I think it loops through all the files after sorting or possibly even copies every splashscreen image over the top of the default image. Either way it works to my satisfaction. Please feel free to let me know a better/faster way of doing the same thing.ziguranaParticipant03/21/2016 at 12:12Post count: 101
I like this game of optimize a trivial problem:
shuf -n 1 -e [FolderWithPrettyPictures]/*.png | cp [TargetDir]/splashscreen.png
Uses shuffle to get the first random entry, and one less pipe.pi-guyParticipant03/23/2016 at 06:25Post count: 32
Yup, I agree it’s trivial, but problem it isn’t – it’s a “what the executives in my biz call” feature. I was reviewing the shuf command, saw it in some sample scripting but I thought I saw that it required additional packages to work. Haven’t tried your code myself but I’d declare you the winner as long as nothing else needs to be installed for shuf to work…. Thanks for playing and I’ll try it as soon as I can.dankcushionsParticipant03/24/2016 at 18:46Post count: 432
nice! i much prefer this to the previous screenshot randomizer as this one lets you have everything in one folder, rather than a subfolder-per-splash. great work! IMO this should be part of the official release, or at least an option in the script.
btw, i couldn’t get @zigurana’s optimisation to work. very possible i was pasting it in incorrectly – not sure if it was supposed to replace everything apart form the ‘exit 0’ or what!pi-guyParticipant03/25/2016 at 06:57Post count: 32
Thanks for the pat on the back, I tried zigurana’s script too and it didn’t work for me either. Could be me, but like I said I think the “shuf” command requires another package to be installed, no point in installing additional stuff if you can work with what you got I suppose.ziguranaParticipant03/29/2016 at 22:49Post count: 101
Nah, I screwed up the script. <shame> I posted without actually trying it </shame>
This works though:
# By default this script does nothing. sudo cp $(shuf -n 1 -e /home/pi/RetroPie/splashscreens/*.png) /opt/retropie/supplementary/splashscreen/00_random_splash/splashscreen.png exit 0
As you can see, it uses shuf, which is available by default, and copies the output to a new dir I made for this purpose (00_random_splash).
I must admit it is somewhat more cryptic than the while-loop approach, but this one fits on a single line! ;-)pi-guyParticipant03/30/2016 at 06:41Post count: 32
Yup, that did it, I noticed that the shuf command at the command line didn’t return a error so I figured I was wrong but had already written the above and hadn’t gotten around to editing it.
sudo cp $(shuf -n 1 -e /home/pi/RetroPie/splashscreens/*.png) /opt/retropie/supplementary/splashscreen/retropie2015-blue/splashscreen.png
I also noticed you used the 00_random_splash directory instead of the one I listed above. I know I changed my default screen once so it could be that I’m wrong with the directory, but I’ve posted the one that worked for me just in case.
Thanks for the help!
- The forum ‘Everything else related to the RetroPie Project’ is closed to new topics and replies.