Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expand sort by filename to ignore common English articles, and persist setting #726

Closed
wants to merge 1 commit into from

Conversation

PhilaPhan80
Copy link

This enhancement adds sorting of file names ignoring common leading English articles (a, an, the) in both ascending and descending order, similar to other media-based systems. It also applies the change to all systems across the board, and it persists the change so it can be restored upon restart/reboot.

For example:

[FILENAME, ASCENDING]
A Boy and His Blob
Adventures of Lolo
Marble Madness
The Legend of Zelda
Yoshi's Cookie

[FILENAME (IGNORE ARTICLES), ASCENDING]
Adventures of Lolo
A Boy and His Blob
The Legend of Zelda
Marble Madness
Yoshi's Cookie

Changes:

  • Adds SortType enum to FileSorts namespace so values can be uniquely referenced by ID
  • Adds sort by filename with common leading articles ignored (hard-coded with room for optimization)
  • Applies SortType selection across all systems on value change
  • Saves and persists SortType selection for future sessions (es_settings.cfg)
  • Applies SortType selection across all systems on ES startup

…t setting (#2)

* Added Daphne to mimic Arcade for TheGamesDB scraper

* Added Daphne entry to PlatformId enum

* Temporarily changing version number

* Testing new file sorting function

* Forgot to change function name when copied/pasted

* Forgot to add new selection to FileSorts.h

* Testing new FileSort IDs & fake reloading settings

* Changed SortType to SortTypeEnum to avoid conflict

* Fixed missing semicolon and reverted enum name

* Debugging

* Debugging

* Debugging

* Added save function

* Added mSaveFuncs declaration

* Added addSaveFunc

* Set the value of SortType before saving

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Cleanup

* Attempt applying saved sort type on startup

* Applying staged changes

* Debugging

* Debugging

* Debugging

* Debugging

* Cleanup

* Apply sort selection to all systems on GUI exit

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Cleanup

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Debugging

* Cleanup

* Cleanup
@dankcushions
Copy link
Member

dankcushions commented Jan 21, 2021

Regarding older change #240, it looks like this sort of obsoletes the <sortname> functionality? eg, if you had

<name>The Legend Of Zelda</name>
<sortname>Legend Of Zelda, The</sortname>

it would behave exactly the same as if you had

<name>The Legend Of Zelda</name>
<sortname></sortname>

as it would ignore the article by default? so sortname would be kind of redundant apart from if it was something NOT handled automatically, eg:

<name>The Legend Of Zelda</name>
<sortname>Zelda 1</sortname>

i still think it's a good idea as it means this basic stuff is automatic and doesn't require gamelist/scraper intervention, although i suppose it would leave no solution for the maniacs who DO want to sort "The Legend of Zelda" under T :)

EDIT: i see the options now - by default it uses the old sorting, so it would appear fine if it doesn't affect the older sortname functionality 👍

@PhilaPhan80
Copy link
Author

Thanks for considering this. Your edit is correct -- the system continues to work the way it does today by default. This is a setting users would need to apply in order to override the current behavior.

You make a good point about #240, though. Indeed, my intention was to make this automatic and without need for manual intervention. However, I have no desire to obsolete other features. Rather, I'd prefer them to work in harmony with each other.

Reflecting upon this further, I believe the best solution might be to add a system-wide option within the START menu, rather than enforcing a system-wide selection within the SELECT menu. When enabled, this would allow common articles to be ignored for both "sortname" and "name", and for ALL sort types (name, rating, developer, genre, etc.). When disabled, sorting would continue to work the way it does today. This also eliminates the need for the additional sort entries within the sort type list.

Lastly, on a side note, now that I know how settings are stored and loaded, I could probably work the articles into the settings file as a comma-delimited text string.

With that said, I'm going to close this request. I'll take a closer look and submit a new PR shortly.

@joolswills
Copy link
Member

Thanks for your work on this.

@PhilaPhan80
Copy link
Author

Thank YOU all! Without your work, I wouldn't be able to enjoy this wonderful project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants