Skipping "The" in sorting game titles in EmulationStation?
-
Re: Any way to sort games a certain way?
Any update on adding this capability? The Legend of Zelda should be in the L's, not the T's.
-
I believe one way would be to rename the <name> in your gamelist.xml from The Legend of Zelda to Legend of Zelda, The. Python would be useful to write a script to automatically do this for all of your games. Good luck!
-
@sub_atomic i dont used gamelists except for lr-mess roms as the are mame style names with no list to correct them. But every rom i had that started with "the" i moved the "the" to the end so something like "The New Super Mario Bros." would be "New Super Mario Bros., The"
-
I happen to have written a python script to do just that. You need to hardcode the system(s) that you want to operate on inside the script, and it will change the entries in your gamelist.xml and then it will OVERWRITE your existing gamelist.xml file. PLEASE make a backup copy of your gamelist.xml (gamelist.xml.bak) before running this
I use this on my own system without any problems, and I hope it works for you, but I can't make any guarantees.
#!/usr/bin/env python import xml.etree.ElementTree as ET ## root location of gamelists xmldir='/home/pi/.emulationstation/gamelists/' ## hardcoded list of gamelist subdirectories to modify #systemlist=['snes', 'genesis', 'gba', 'gb', 'gbc', 'atari2600', 'nes', 'pcengine','gamegear'] systemlist=['snes'] ## loop through systems for system in systemlist: xmlfile = xmldir+system+'/gamelist.xml' ## parse the gamelist file tree=ET.parse(xmlfile) root=tree.getroot() ## loop through games for game in root: name = game.find('name').text ## check if game starts with 'The ' if name[0:4] == 'The ': ## search for a ':' in the name e.g. The Addams Family: Pugsley's Scavenger Hunt iend=name.find(':') if iend != -1: ## if ':' exist ## Insert ', The' right before ':' ## Addams Family, The: Pugsley's Scavenger Hunt name2=name[4:iend]+', The'+name[iend:] else: ## if ':' does not exist ## Append ', The' at the end name2=name[4:]+', The' ## replace the game name print 'changing "'+name+'" to "'+name2+'"' #game.set('name',name2) game.find('name').text=name2 print 'writing '+xmldir+system+'/gamelist.xml' tree.write(xmldir+system+'/gamelist.xml',encoding="UTF-8")
-
@joemommasfat That's great! As a newbie python coder, just curious about the formatting of the resulting xml file. Does it come out indented appropriately (with amount of indentation based on the xml hierarchy)? I always ended up with what appeared to be all of the text on a single line when manipulating xml, which made for difficulty in readability when editing. I ended up finding some code on the internet to indent the xml appropriately, but if there's a way to do without, I could clean up my code a bit.
Thanks!
-
It comes out formatted with 8 space indentations for sub elements. Here is an excerpt of my snes gamelist (for a modified entry).
<?xml version="1.0"?> <gameList> </game> <game id="3669" source="theGamesDB.net"> <path>./Addams Family, The - Pugsley's Scavenger Hunt (USA).zip</path> <name>Addams Family, The: Pugsley's Scavenger Hunt</name> <desc>As if things weren't ooky enough!...</desc> <image>~/.emulationstation/downloaded_images/snes/Addams Family, The - Pugsley's Scavenger Hunt (USA)-i mage.jpg</image> <releasedate>19930201T000000</releasedate> <developer>Ocean</developer> <publisher>Ocean</publisher> <genre>Platform</genre> <players>1</players> </game> </gameList>
-
Thanks, that's very interesting. Will play around more next time I write a script for the gamelist. Maybe it was just when I added new subelements that those weren't indented like the others, not sure anymore. I also didn't use the encoding parameter in the tree.write. Thanks again for reply!
-
@joemommasfat Thanks for sharing the Python script. It is a workaround, but I really don't like the look of ", The" at the end of game titles. There has to be a way for ES to skip "The" when sorting games in the GUI, so that your games would sort like this:
Kirby Super Star
Kirby's Dream Land 3
The Legend of the Mystical Ninja
The Legend of Zelda: A Link to the Past
Lemmings
Lord of Darkness
The Lost Vikings
Lufia & the Fortress of Doom
Magical Pop'n
The Magical Quest Starring Mickey Mouse
Mario Paint
Mega Man 7 -
Not sure, I guess it's a matter of preference. I prefer the sorting as it is, with all the games in a group to start with the same letter, makes it easier to scan through them for me.
-
@jell You walk into a record store, where are The Beatles, in the B's or the T's? Proper alphabetical sorting should always ignore articles.
-
I guess the short answer is no, that is not a current feature of emulationstation. It has been mentioned before, but so far no one has implemented it.
Why not take a crack at it?
https://github.com/RetroPie/EmulationStation/blob/master/es-app/src/FileSorts.cpp
-
I'd really like to see this feature coded into EmulationStation. I can't believe after 20+ years of emulation that this is still an issue. "The" should not be displayed in the T's unless the next word begins with T. Putting ", The" at the end of a game looks hideous, and is just a lazy way to "fix" this problem.
I'm hoping that somebody who knows how to do these things finally makes this a feature in EmulationStation since emulation on the Pi seems to have a very long future ahead of it.
In the mean time, all of my games on every console will just have a long list of games that start with "The" until somebody codes this. I refuse to put ", The" at the end of the game titles.
Sorry if that came off as rude. I'm usually pretty happy go lucky, but this issue has been a huge pet peeve of mine for 20 years now. :)
-
@used2berx Make a suggestion - offer some ideas, but don't get agitated about it. If it upsets you so much, have you submitted a fix ?
I really dislike it when people come across as entitled - as if somehow you are owed. The original author of ES never implemented this. No-one else has done it either. 20 years of emulation has nothing to do with it.
Maybe someone will find the time, but moaning about it does nothing but annoy people.
-
@buzz I've spent years of my life doing work for the community, and I continue to do it now. I'm not entitled, and I'm not acting entitled. I'm not moaning, and I said so in my post. I also apologized ahead of time if that came off as rude to anybody, so I'm not sure you got to the end of my post before you replied.
I'm not a coder, and I don't care to learn how to code. I do the other work that anybody could do but nobody is crazy or OCD enough to do. I was just mentioning that it's ugly and I can't believe that nobody in 20 years has ever done this anywhere.
-
@used2berx Instead of making the post and apologising at the end, maybe don't come across that way ?
Don't forget that I have also read all your moaning and swearing over at another forum about RetroPie.
-
@buzz
You shouldn't post that site name. They offer roms there.Thanks. :)
BTW... I have had a lot of good things to say about RetroPie, and if you read the bad stuff, you should probably take the time to read on and see how much I've been hyping it the last few months. My initial impressions were not good, but I do see a lot of potential.
The fix I want done can't be done on the XBox. It takes too many resources and would break a few of the emulators that are already pushing the limits of the system to the max. It would just be nice if we could get that to happen on the Pi 3 that shouldn't have any problems handling the extra workload is all.
-
@joemommasfat That's a slightly different request than mine, but a good one also. Could be fixed by sorting game titles by Name, then Release Date.
Coding these changes is WAY beyond my capabilities, but I might know a guy who can make it happen. Haven't talked to him in years, but I'll send this to him and see what he says, thanks.
-
Give this a try.
https://github.com/Joemommasfat/EmulationStation/commit/b02b9bfd8f23307625b0045101e67e23a5271ef0
If you want to use this, change line 139 of ~/RetroPie-Setup/scriptmodules/supplementary/emulationstation.sh
#[[ -z "$repo" ]] && repo="https://github.com/RetroPie/EmulationStation" [[ -z "$repo" ]] && repo="https://github.com/Joemommasfat/EmulationStation"
Then install emulation station from source.
After that, add a "sortname" entry to your gamelist.xml and it will sort on that rather than the default name. I tested it with the entry below, and Super mario world went to the top of the list in ES.
<name>Super Mario World</name> <sortname>1111AAAAA</sortname> <desc>Mario’s off on his biggest
If this works for people, I can put in a pull request and see if it gets into the retropie git.
-
@joemommasfat
Interesting approach, why not stripping out any article (if any) before doing the comparison in Filesorts.cpp?
There is little need to actually storing the scrubbed game-name, unless you foresee a use case for manually setting the sort order to something else? -
Well personally I've always wished Final Fantasy IX was listed after Final Fantasy VII in my list. Now I can set the "sortnames" to "Final Fantasy 9" and "Final Fantasy 7" but keep the display names with Roman numerals.
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.