Take and Scrape Your Own Screenshots
-
@herb_fargus
I avoided the$USER
because I was never really sure when RetroPie/emulationstation is executing a command with the regular user or withsudo
. But now I checked here and it's the regular user (looked at thees_system.cfg
to see the runcommand calling line, nosudo
).I would suggest just some superfluous/cosmetic changes:
- use
$HOME
instead of/home/$USER
; - use a variable to store the image directory path instead type it 3 times (if you change your mind about where to store the images, you have to change only one line):
imgdir="$HOME/RetroPie/roms/$system/images"
- I put a
2> /dev/null
in thescreenshot
's variable find to avoid error messages. I did it because all the error messages when executingruncommand-on{start,end}.sh
scripts are logged inruncommand.log
. I used thatif
to check ifscreenshot
is not empty for the same reason. - the last
find
to delete the unwanted screenshots is fully OK for this application. But for other applications it would delete all the files that match the-name
pattern in the subdirectories too. I usedrm
with-f
because this option ignores nonexistent files, therefore no error messages if there is no screenshots to delete.
Updating my script again...
- use
-
@meleu typo:
rm -f "$imgdir/*RetroArch*
should be
rm -f "$imgdir"/*RetroArch*
I presume. There may be ways we can refactor it further as well
also is the print necessary?
-
@herb_fargus
Actually the double quotes comes in the end, otherwise some parsing problems can happen. Thanks for noting this.[EDIT: this doesn't work. Look the next posts...]
rm -f "$imgdir/*RetroArch*"
-
@meleu you should really test things before you say them authoritatively ;) quotes at the end doesnt work.
-
@herb_fargus
You're right... updated my script...
I deserve a downvote!
-
@meleu alright I've taken some of your changes and just tweaked it a bit, and modified the original post. It seems to be working with my tests.
There may have been a slight lag either because I was taking screenshots too fast or I exited before it could be saved properly so it saved a screenshot from a couple seconds earlier rather than my latest one, so I'll have to look into that a little further. If you don't take a ton in a short period of time it seems to work as intended.
Also if anyone else cares, if you set it to 16:9 in the retroarch.cfg your screenshots will also be 16:9 rather than 4:3
-
@herb_fargus
I was thinking about this trick again and realized one thing:When using this trick, the user can't get screenshots for any other purpose.
The
runcommand-onend.sh
will delete the screenshots.While we don't make a workaround for this, I think it would be appropriate to add this warning at the first post disclaimers.
-
@meleu They can as long as they change the screenshot directory to somewhere else other than the images folder within a rom folder.
-
This tutorial could make a great entry in the RetroPie Wiki! What do you guys think?
-
@hiulit perhaps once I've cleaned up the code a bit more, might even be able to make a module of sorts perhaps, idk. Id also like for 4.0 to be released before adding something like this.
-
@herb_fargus Yeah sure, no rush! Just thinking out loud. Great work, btw!
-
@meleu said
When using this trick, the user can't get screenshots for any other purpose.
If they change the screenshot directory, they are not using this trick. :-)
-
@meleu its a fair point. how I envisions it is that people will just go through their gamelist once to get titleshots and then disable it or something. Idk, thats what I did anyways ha ha
-
@herb_fargus
BTW: I'm working on RetroArch code to implement what is said here: https://retropie.org.uk/forum/topic/2483/screenshot-with-rom-name
If it works as expected and the libretro guys accept my PR (not submitted yet), we must adapt this trick. Then, let's wait before the wiki... -
@meleu that would save a step ;) I think there are others that would be happy for that implementation as well
-
@herb_fargus
When I was playing with RetroArch code I found that there is an option namedauto_screenshot_filename
.As far as I understood, if this flag is set to "true" in
retroarch.cfg
, the screenshot filename is alwaysGame Name.png
, therefore it overwrites the old screenshot. It would be a really really nice feature for the trick we want to do here. Because we could turn on/off the trick based onauto_screenshot_filename
flag.The only problem is: I didn't get it working!
I made some tests here and it seems to be ignored by RetroArch. What a pity...
Sorry for this good followed by a bad news...
-
@meleu that auto screen name thing would be ideal.
If the filename retains the date and time that will require a bit more logic to clean for the filenames when scraping. Its a step in the right direction though
-
Oh! But I have good news now:
My PR was merged! Let's update RetroArch from source!! :DNow we have a problem here... our trick here will be incompatible soon. And if we adapt to fit the changes in the screenshot names, it won't be useful for outdated versions of RetroArch...
Oh god! Good followed by a bad news again... :-/
[EDIT: well, maybe if we adapt the RegEx to get the timestamp instead of the "RetroArch" string it can work as we want. I'll take a look at it later...]
-
@meleu simple enough fix, just have both versions or add a disclaimer for people to update from source - or we could figure out that extra setting ;)
-
@herb_fargus said in Take and Scrape Your Own Screenshots:
@meleu that auto screen name thing would be ideal.
damn! You hit me! I'll check what's wrong with the
auto_screenshot_filename
option and try to make it work!
Contributions to the project are always appreciated, so if you would like to support us with a donation you can do so here.
Hosting provided by Mythic-Beasts. See the Hosting Information page for more information.