• Recent
  • Tags
  • Popular
  • Home
  • Docs
  • Register
  • Login
RetroPie forum home
  • Recent
  • Tags
  • Popular
  • Home
  • Docs
  • Register
  • Login
Please do not post a support request without first reading and following the advice in https://retropie.org.uk/forum/topic/3/read-this-first

How can I create a "list of games" - Just the titles only?

Scheduled Pinned Locked Moved Help and Support
gamelistorganizationemustation
18 Posts 3 Posters 2.0k 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.
  • T
    TPR @TPR
    last edited by 5 Dec 2020, 22:49

    @mitu not found.jpg

    T 1 Reply Last reply 5 Dec 2020, 22:55 Reply Quote 0
    • T
      TPR @TPR
      last edited by 5 Dec 2020, 22:55

      @mitu nevermind I just saw my typo. My brain was still thinking of the "old version" of excel!

      1 Reply Last reply Reply Quote 0
      • T
        TPR @mitu
        last edited by TPR 12 May 2020, 23:14 5 Dec 2020, 23:13

        @mitu said in How can I create a "list of games" - Just the titles only?:

        grep '<name>' ~/.emulationstation/gamelists//.xml

        I keep getting the following error running the python script:
        error.jpg

        Honestly, is there any way to output the data from the following command to a file instead of to the screen?
        grep '<name>' ~/.emulationstation/gamelists//.xml

        T M 2 Replies Last reply 5 Dec 2020, 23:18 Reply Quote 0
        • T
          TPR @TPR
          last edited by TPR 12 May 2020, 23:23 5 Dec 2020, 23:18

          I found it!
          grep '<name>' ~/.emulationstation/gamelists//.xml > outputfile.txt

          That actually works great for me!

          Thanks again for all your help!

          C 1 Reply Last reply 6 Dec 2020, 08:29 Reply Quote 1
          • M
            mitu Global Moderator @TPR
            last edited by 6 Dec 2020, 04:28

            @tpr said in How can I create a "list of games" - Just the titles only?:

            Honestly, is there any way to output the data from the following command to a file instead of to the screen?

            Looks like one of your gamelists is malformed, if you run the script with the -d switch, it will tell you which system has the issue.

            T 1 Reply Last reply 6 Dec 2020, 05:56 Reply Quote 0
            • T
              TPR @mitu
              last edited by 6 Dec 2020, 05:56

              @mitu Thanks!

              1 Reply Last reply Reply Quote 0
              • C
                Clyde @TPR
                last edited by Clyde 12 Jun 2020, 08:33 6 Dec 2020, 08:29

                @tpr said in How can I create a "list of games" - Just the titles only?:

                I found it!
                grep '<name>' ~/.emulationstation/gamelists//.xml > outputfile.txt

                Very good, I like it when people work out their own solutions. 👍

                In addition, you could "pipe" the output through the command sort to get a sorted list, as the gamelist.xml isn't sorted per se, and can become disordered after new games are added or if you scrape them multiple times with scrapers that append to the gamelist.xml instead of recreating it completely.

                grep '<name>' ~/.emulationstation/gamelists/*/*.xml | sort > outputfile.txt
                

                Mind though that the above command will "walk" through any directory in ~/.emulationstation/gamelists/ and every xml file within them, and display all of their game names. So, if you have multiple systems and/or xml files within them (e.g. backups like gamelist-backup.xml), you might want to change */*.xml to the exact gamelist in question, e.g.

                grep '<name>' ~/.emulationstation/gamelists/arcade/gamelist.xml | sort > outputfile.txt
                

                And finally, if you want an output without the <name> tags, use my solution with xmlstarlet. Its only (tiny) drawback is that it has to be installed first, whereas grep comes pre-installed in any Linux system that I know of.

                As always, there are multiple ways to solve single problems. 🤓

                M 1 Reply Last reply 6 Dec 2020, 08:51 Reply Quote 0
                • M
                  mitu Global Moderator @Clyde
                  last edited by 6 Dec 2020, 08:51

                  @clyde said in How can I create a "list of games" - Just the titles only?:

                  Its only (tiny) drawback is that it has to be installed first, whereas grep comes pre-installed in any Linux system that I know of.

                  xmlstarlet is automatically installed by RetroPie, so it should always be available.

                  C T 2 Replies Last reply 6 Dec 2020, 10:40 Reply Quote 1
                  • C
                    Clyde @mitu
                    last edited by 6 Dec 2020, 10:40

                    @mitu Interesting, I thought I had to install it back then (or whenever I installed RP 4.6). But one tends to forget such one-time installs, so … 😉

                    1 Reply Last reply Reply Quote 0
                    • T
                      TPR @mitu
                      last edited by TPR 11 May 2022, 02:16 5 Nov 2022, 02:13

                      @mitu So coming back to this topic I had another question...

                      While the grep command actually works great and I get ALMOST exactly what I need from that, the one issue is still is there is anything in my gamelist that ended being deleted or edited and didn't get removed from the gamelist, that data is still output in the .txt file that grep generates.

                      What I'm looking for is a text output of exactly the same list I see on my screen. Clearly, Emulation Station must pull the data from somewhere to display it on my screen so there's got to be a way to instead have it go to a text file, right?

                      Is there any way to do that?

                      M 1 Reply Last reply 5 Nov 2022, 03:48 Reply Quote 0
                      • M
                        mitu Global Moderator @TPR
                        last edited by 5 Nov 2022, 03:48

                        @TPR said in How can I create a "list of games" - Just the titles only?:

                        Clearly, Emulation Station must pull the data from somewhere to display it on my screen so there's got to be a way to instead have it go to a text file, right?

                        EmulationStation checks if the file exists on disk before adding it to the list, but it still reads from the gamelist.xml.

                        You can output the game name and the path at the same time and then read the output in a script that would check if the path is still valid before printing the game. Here's a command that outputs a tab separated list of game path values.

                        xmlstarlet sel -t -m '//game' -v 'name' -o $'\t' -v 'path' -n gamelist.xml
                        
                        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.

                          This community forum collects and processes your personal information.
                          consent.not_received