Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • pi-guy
    Participant
    Post 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.

    Step 1:
    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

    Step 2:
    Make sure you haven’t changed the default splashscreen, if so simply change it back to default in RetroPie’s setting menu

    Step 3:
    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

    Step 4:
    Perform a full system power-off and power-on twice

    Step 5:
    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.

    zigurana
    Participant
    Post count: 101

    Cool!
    I like this game of optimize a trivial problem:
    What about:
    shuf -n 1 -e [FolderWithPrettyPictures]/*.png | cp [TargetDir]/splashscreen.png

    Uses shuffle to get the first random entry, and one less pipe.

    pi-guy
    Participant
    Post 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.

    dankcushions
    Participant
    Post 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-guy
    Participant
    Post count: 32

    @dank
    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.

    zigurana
    Participant
    Post 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-guy
    Participant
    Post 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!

    dankcushions
    Participant
    Post count: 432

    worked for me also! nice work both :) i have an increasingly large .txt doc with all the things i do post install of a new image, and this totally makes it :)

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.