How can I create a "list of games" - Just the titles only?
-
-
@mitu nevermind I just saw my typo. My brain was still thinking of the "old version" of excel!
-
@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:
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 -
I found it!
grep '<name>' ~/.emulationstation/gamelists//.xml > outputfile.txtThat actually works great for me!
Thanks again for all your help!
-
@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. -
@mitu Thanks!
-
@tpr said in How can I create a "list of games" - Just the titles only?:
I found it!
grep '<name>' ~/.emulationstation/gamelists//.xml > outputfile.txtVery 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 likegamelist-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 withxmlstarlet
. Its only (tiny) drawback is that it has to be installed first, whereasgrep
comes pre-installed in any Linux system that I know of.As always, there are multiple ways to solve single problems. 🤓
-
@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. -
@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 … 😉
-
@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?
-
@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
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.