RetroPie forum home
    • Recent
    • Tags
    • Popular
    • Home
    • Docs
    • Register
    • Login

    Take and Scrape Your Own Screenshots

    Scheduled Pinned Locked Moved Ideas and Development
    retroarchscreenshotscrapesselphruncommand
    122 Posts 8 Posters 66.5k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • meleuM
      meleu
      last edited by meleu

      Now I would like to share some info I obtained during the time I was working on this script for future references.

      I made intensive tests with several really% $trange&char*cter's [in] ^ROM\ <file> "names".ext and I've got some conclusions:

      • Linux file systems (and most of the UNIX-like file systems) are very permissive with characters used in filenames. Actually, the only two reserved chars for filenames in POSIX systems are / and null char (source).

      • Many of the files with strange chars don't even launch the emulator.

      • Some failed launches occur due to ES limitations: the ES try to launch a game and I can't see the runcommand dialog, then it goes back to ES.

      • Aloshi says in the gamelists documentation: "One thing to be aware of: the EmulationStation text rendering code doesn't currently support Unicode. If I fix this in the future, it will probably use UTF-8. For now, you'll just have to convert names and descriptions to ASCII. Sorry!"

      • Some other failed launches occur due to runcommand limitations: I can see the runcommand dialog, then it goes back to ES.

      • if the rom name has two or more consecutive spaces, the game launches OK, but the RetroArch isn't able to create a screenshot for this game. Everything seems to be OK, I play the game, I take screenshots with no failed messages, but when I look at the screenshots directory the image isn't there. It seems to be a RetroArch bug.

      All the games I managed to launch AND take screenshot, my scrape method worked fine.

      Example of strange rom name that worked fine: mega$ man[vs]dr& willy\< USA >[!].nes

      • Useful topics
      • joystick-selection tool
      • rpie-art tool
      • achievements I made
      herb_fargusH 1 Reply Last reply Reply Quote 0
      • herb_fargusH
        herb_fargus administrators @meleu
        last edited by

        @meleu I don't like the idea of two wiki pages explaining the same thing. It would make more sense to just have a heading in the original wiki page for each method. The less pages we can have in the wiki the better as its getting quite large

        If you read the documentation it will answer 99% of your questions: https://retropie.org.uk/docs/

        Also if you want a solution to your problems read this first: https://retropie.org.uk/forum/topic/3/read-this-first

        meleuM 2 Replies Last reply Reply Quote 0
        • meleuM
          meleu @herb_fargus
          last edited by

          @herb_fargus
          I'm gonna try to edit and put both methods in one page.

          • Useful topics
          • joystick-selection tool
          • rpie-art tool
          • achievements I made
          1 Reply Last reply Reply Quote 0
          • meleuM
            meleu @herb_fargus
            last edited by meleu

            @herb_fargus
            When trying to merge the common info I realized a few things that I would like to know your opinion:

            retroarch.cfg

            method 1

            The runcommand-onstart.sh always force the configs

            auto_screenshot_filename = "false"
            screenshot_directory = "$HOME/RetroPie/roms/$system/images"
            

            Pros:

            • no need to manually edit the retroarch.cfg.
            • simplifies the scraper command.

            Cons:

            • if the user want to configure these options with different values in retroarch.cfg the script will always overwrite the changes with those from the script. It can bring confusion.
            • if the user wants to disable the script, he must to delete the runcommand-onstart.sh AND manually edit every single system retroarch.cfg (therefore, it invalidates the first pro).

            method 2

            The user must to edit retroarch.cfg manually.

            Pros:

            • Respect what is in retroarch.cfg.
            • Only user comfortable with file editing will feel confident to do it. (ok, ok... putting this as a pro is a matter of opinion)

            Cons:

            • Inexperienced users will avoid it. (the very same thing of the 2nd pro, but put in other point of view).

            My question

            Do you want to keep that runcommand-onstart.sh in the wiki?

            [EDIT]
            We can instruct the users to manually set the configs in the system's retroarch.cfg as expected by the method 1 instead of using the script.

            • Useful topics
            • joystick-selection tool
            • rpie-art tool
            • achievements I made
            herb_fargusH 1 Reply Last reply Reply Quote 0
            • herb_fargusH
              herb_fargus administrators @meleu
              last edited by

              @meleu yes I think we should keep the runcommand option, I didn't think about the whole configs staying thing but I think we could technically add a function to remove the configs with onend or really tbh if people are going to be using this method I would expect they have a basic competency in editing files and if they dont I would expect they have a basic enough competency to learn.

              I think we've coddled people too much with RetroPie . The pi is for learning and doing cool things and that requires taking the time to learn it and make mistakes.

              I think both approaches are valid and as you mentioned both have their pros and cons. We should allow the user to make a decision on what will work best for them, and if they become confused on it they should take the time to troubleshoot and learn why so they can actually learn.

              If you read the documentation it will answer 99% of your questions: https://retropie.org.uk/docs/

              Also if you want a solution to your problems read this first: https://retropie.org.uk/forum/topic/3/read-this-first

              meleuM 1 Reply Last reply Reply Quote 3
              • meleuM
                meleu @herb_fargus
                last edited by meleu

                @herb_fargus
                Merged the two methods in the wiki. I hope you like it.
                [EDIT: if you have you have time, could you check it for grammar mistakes? English is not my native language.]

                • Useful topics
                • joystick-selection tool
                • rpie-art tool
                • achievements I made
                herb_fargusH 1 Reply Last reply Reply Quote 0
                • herb_fargusH
                  herb_fargus administrators @meleu
                  last edited by

                  @meleu looks great, thanks for doing that :)

                  If you read the documentation it will answer 99% of your questions: https://retropie.org.uk/docs/

                  Also if you want a solution to your problems read this first: https://retropie.org.uk/forum/topic/3/read-this-first

                  1 Reply Last reply Reply Quote 0
                  • G
                    gomisensei
                    last edited by gomisensei

                    OK, the method2 onend script isn't working. It saves a copy of the gamelist.xml from the ES gamelist dir to my rom dir (if one doesn't already exist there) , there is definitely an image file called "pacman.png" (or whatever) in the "~/RetroPie/roms/arcade/images" dir, but the log says

                    --- start of runcommand-onend.sh ---
                    There is no screenshot for "pacman" in the "~/RetroPie/roms/arcade/images" folder.
                    Exiting...

                    file is there, everything is set correctly, I think

                    meleuM 2 Replies Last reply Reply Quote 0
                    • meleuM
                      meleu @gomisensei
                      last edited by meleu

                      @gomisensei
                      It worked fine for me. Let's see what is happening...

                      According to what you said, it's failing on this test:

                      if ! [[ -f "$screenshot_dir/$image" ]]; then
                      

                      Can you paste here the output of ls -l ~/RetroPie/roms/arcade/images/*.png?

                      [EDIT: you are right, everything is set correctly. Otherwise the script would interrupt before and with other log messages. I'm suspecting of file names...]

                      • Useful topics
                      • joystick-selection tool
                      • rpie-art tool
                      • achievements I made
                      G 1 Reply Last reply Reply Quote 0
                      • meleuM
                        meleu @gomisensei
                        last edited by

                        @gomisensei
                        I reproduced your problem. I've just realized that the if statement doesn't recognize the tilde ~ symbol as the home directory! Look:

                        pi@retropie:~ $ [[ -d "~/RetroPie" ]] && echo directory exists
                        pi@retropie:~ $ [[ -d "/home/pi/RetroPie" ]] && echo directory exists
                        directory exists
                        pi@retropie:~ $ 
                        

                        Well, to make it work for you, change your screenshot_directory in the respective retroarch.cfg to /home/pi/RetroPie/...

                        I'll update the wiki mentioning this issue. Thanks for your feedback!

                        • Useful topics
                        • joystick-selection tool
                        • rpie-art tool
                        • achievements I made
                        herb_fargusH G 3 Replies Last reply Reply Quote 0
                        • G
                          gomisensei @meleu
                          last edited by

                          @meleu maybe you could add (if just for debug), exactly what filename the script is looking for and not finding? also, is it supposed to save a copy of the es gamelist to your rom dir? or is that just temporary? would i need to manually move it to the es gamelist dir when ES quits, so it won't be overwritten on exit?

                          meleuM 1 Reply Last reply Reply Quote 1
                          • herb_fargusH
                            herb_fargus administrators @meleu
                            last edited by

                            @meleu you may want to use an environment variable rather than hardcoding if you want it to work irrespective of the platform: e.g. [[ -d "$HOME/RetroPie" ]]

                            If you read the documentation it will answer 99% of your questions: https://retropie.org.uk/docs/

                            Also if you want a solution to your problems read this first: https://retropie.org.uk/forum/topic/3/read-this-first

                            meleuM 1 Reply Last reply Reply Quote 0
                            • G
                              gomisensei @meleu
                              last edited by

                              @meleu i didn't use the ~ in my config file, but retroarch changed it from home/pi/ to ~/

                              1 Reply Last reply Reply Quote 0
                              • meleuM
                                meleu @herb_fargus
                                last edited by

                                @herb_fargus but the script must get the directory from retroarch.cfg screeshot_directory. The user can put any valid path there.

                                @gomisensei I used /home/pi and it works fine here...

                                • Useful topics
                                • joystick-selection tool
                                • rpie-art tool
                                • achievements I made
                                G 1 Reply Last reply Reply Quote 0
                                • G
                                  gomisensei @meleu
                                  last edited by

                                  @meleu just re-entered the first line in arcade/retroarch.cfg as screenshot_directory = "/home/pi/RetroPie/roms/arcade/images", saved, then when i ran retroarch, it changed the /home/pi/ to ~/ again as soon as i exited...

                                  meleuM 1 Reply Last reply Reply Quote 0
                                  • meleuM
                                    meleu @gomisensei
                                    last edited by

                                    @gomisensei said in Take and Scrape Your Own Screenshots:

                                    @meleu maybe you could add (if just for debug), exactly what filename the script is looking for and not finding?

                                    good point. I'll change it.

                                    is it supposed to save a copy of the es gamelist to your rom dir? or is that just temporary?

                                    It's the real intention. Because if the user want to go back the only thing to do is to delete this file and emulationstation will get the gamelist.xml from ~/.emulationstation/gamelist/SYSTEM/gamelist.xml. Look the precedence order here: https://github.com/RetroPie/EmulationStation/blob/master/GAMELISTS.md

                                    would i need to manually move it to the es gamelist dir when ES quits, so it won't be overwritten on exit?

                                    No. It'll be "overwritten" (maybe "updated" fits better) only if "save metadata on exit" is on. And it doesn't remove entries, it just updates the last played and times played info (not sure if it updates more info).

                                    • Useful topics
                                    • joystick-selection tool
                                    • rpie-art tool
                                    • achievements I made
                                    1 Reply Last reply Reply Quote 0
                                    • meleuM
                                      meleu @gomisensei
                                      last edited by meleu

                                      @gomisensei said in Take and Scrape Your Own Screenshots:

                                      @meleu just re-entered the first line in arcade/retroarch.cfg as screenshot_directory = "/home/pi/RetroPie/roms/arcade/images", saved, then when i ran retroarch, it changed the /home/pi/ to ~/ again as soon as i exited...

                                      Are you using save_config_on_exit = "true"?

                                      [EDIT: the script must deal with it anyway. I'll update it and let you know when it is ready.]

                                      • Useful topics
                                      • joystick-selection tool
                                      • rpie-art tool
                                      • achievements I made
                                      G 1 Reply Last reply Reply Quote 0
                                      • herb_fargusH
                                        herb_fargus administrators @meleu
                                        last edited by

                                        @meleu ah i didnt realise it was something the user set. nvm then. carry on

                                        If you read the documentation it will answer 99% of your questions: https://retropie.org.uk/docs/

                                        Also if you want a solution to your problems read this first: https://retropie.org.uk/forum/topic/3/read-this-first

                                        1 Reply Last reply Reply Quote 0
                                        • G
                                          gomisensei @meleu
                                          last edited by gomisensei

                                          @meleu tried it with "save on exit" set to false, now retroarch doesn't change it to ~, and no error in the runcommand. The gamelist.xml in my roms dir now has 2 entries for the game i screenshotted, one without the <image> and one (at the end of the file) with the <image>, but lost the <name> data, which was replaced with the romname.

                                          I'm using -lr-fba-next running out of the "arcade" section, to try and screenshot "99lstwar.zip", which the name for is "99: The Last War". Before running the script, ES showed the correct full name; after running it, i have my screenshot, but it's listed as "99lstwar"

                                          manually copied the gamelist.xml,

                                          edit: guess the last was an unnecessary step, but I tried with another game, same result.

                                          2nd edit: lost the descriptions also

                                          meleuM 2 Replies Last reply Reply Quote 0
                                          • meleuM
                                            meleu @gomisensei
                                            last edited by meleu

                                            @gomisensei
                                            I've updated the script to deal with the tilde ~ and to print the full path file name to the image as you suggested.
                                            You can get it again:

                                            wget https://raw.githubusercontent.com/meleu/src/master/screeper.sh
                                            mv screeper.sh /opt/retropie/configs/all/runcommand-onend.sh
                                            

                                            The gamelist.xml in my roms dir now has 2 entries for the game i screenshotted, one without the <image> and one (at the end of the file) with the <image>

                                            Yeah. I've noticed it when trying to reproduce your issue. I will work on it.

                                            I'm using -lr-fba-next running out of the "arcade" section, to try and screenshot "99lstwar.zip", which the name for is "99: The Last War". Before running the script, ES showed the correct full name; after running it, i have my screenshot, but it's listed as "99lstwar"

                                            Oh. I developed and tested the script only with the classics consoles, it was easy because they are used to use the ROM file name. The arcade games use the complete name of the game in ES. I'll try to adapt the script to deal with it.

                                            2nd edit: lost the descriptions also

                                            Do you mean the script deleted your metadata? I can't see how it can do this.

                                            Thanks for your detailed feedback!

                                            • Useful topics
                                            • joystick-selection tool
                                            • rpie-art tool
                                            • achievements I made
                                            G 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            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.