ES Filter by Genre, Publisher/Developer, Players and Rating
-
@Zigurana Oh my, you're looking into my code! <quickly closes the curtains> :)
Happy to discuss wherever you feel it's appropriate, would certainly love to.
I'll be honest: the code is still very much work in progress - I'm sure there still is a bit of refactoring to do there before merging it, in order to make it even more generic, but for now I just wanted to get it out the door. I'm also sure that, asides from the tremendous logging code that I still have there (I am debugging via logs) that needs to be cleaned up, there are quite likely several methods to delete and a handful of them that are not even being used at the moment as the design evolved while it was being developed.
Happy to have it here, on GitHub (how does that work?), or even over email - whatever works.
Thanks!
-
Ha! Don't worry, it all looks very decent if you ask me, nothing at all to be ashamed of.
I was (of course) thinking how to leverage this to allow a new iteration of the Kid-modes stuff, as it's in such a similar domain.
I 'll try take it to Github to comment on particular parts of the code. -
@Zigurana Ah, of course.
In fact, as I was developing it, I was thinking about, if we actually had the metadata for favorites and kids being loaded into the current ES version, that this would very easily handle it - it can probably be added in 15-30 mins, if that much.
Happy to chat!
EDIT:
Actually, thinking about the previous talk we had about breaking down the Kids mode into smaller commits, if you do add the metadata PR, this can handle the filtering easily without you having to implement it again.
This indexes the games at load time, and then at render time, we filter. I implemented a hacky "empty" item, so that it wouldn't crash if there's no match for the filter combination.
The main difference is that this is not system-wide, but more by design (because different systems will have different developers/publishers/etc), but nothing prevents us from filtering system-wide for kids and favorite at render time.
On metadata editing (or, in your case, on setting favorite and kid-friendly), I just remove the game from the index and re-insert it again with the new metadata. That's so I can remove categories from the index that do not match any current game data.
Hope these help.
Edit 2: and yes, I tried to design it in a way that can be easily adapted to whatever metadata architecture we end up pursuing (xml, SQLite or something else). :)
-
How about the ability to Star or Favorite games? That was what a LOT of us have been asking for off and on for a while - it would make those LONG (like 1000+) complete game libraries so much easier to navigate through if our most favorite games could be brought to the top of the list (or something like that). I'm currently stuck using folders...
-
@Dochartaigh Yeah, I was just answering @Zigurana in that direction. He already did the whole work of adding that metadata.
If you use this, for the time being, you can just filter by 5 star ratings, for instance, but I agree - favorites and kid friendly should be a straight application of this, and as I said, it's fairly easy to implement should the metadata be there.
-
@pjft I am testing this out on my linux desktop. I pulled the latest source from your github repository and built it myself. I haven't had a chance to dig in to find the cause, but if I pick a set of filters that would result in no games available, I get a core dump.
terminate called after throwing an instance of 'std::out_of_range' what(): vector::_M_range_check: __n (which is 0) >= this->size() (which is 0) Aborted (core dumped)
-
@jdrassa wonderful :)
Thanks for looking into this.
That's interesting, as that exact behavior should be... Explicitly... Coded... For. Hmm.
Unless it just got busted when I refactored the code to move the filtering to FileData!
That may be the case.
I'll try it out later and dig into it. I don't recall testing whether an empty selection still worked after I did the last change.
Thanks! I'll get back to you, no need to waste time tracking it down - unless you do have a proper way to do debugging other than via logs, which is how I'm doing it. If that's the case, if you can track down the exact line where it's crashing it's easier for me, but it still shouldn't be a big deal for me to track down otherwise.
Happy Saturday!
-
@pjft said in ES Filter by Genre, Publisher/Developer, Players and Rating:
@Dochartaigh Yeah, I was just answering @Zigurana in that direction. He already did the whole work of adding that metadata.
If you use this, for the time being, you can just filter by 5 star ratings, for instance, but I agree - favorites and kid friendly should be a straight application of this, and as I said, it's fairly easy to implement should the metadata be there.
it would be cool if there is also some visual indication in the gamelist already as well (recalbox has a star in front of the game name if it's a favorite + moved to the top of the list)
-
@jdrassa Of course, that was the case. Had left some logic in the view that should have moved to FileData.
Should be sorted now - apologies for the trouble, and thank you for catching it!
If you pull the code now it should work now.
@daeks Different feature request :) We don't have favorites yet, but that's a good idea if/when it ends up being implemented, should it be easy.
Sorting shouldn't be hard - the visual component I imagine will need to be done at a theme level. That does not exist at the moment.
Thanks both!
-
@jdrassa FYI, there's a leftover problem from the refactoring where in some occasions the gamelist will reset to the first on the list.
I'll look into it today.
EDIT: and it's fixed now. Should be all sorted! Thanks for testing.
-
Hey @pjft, I know this is an older thread, but I have a question that relates to how the filtering works:
If I select 2 options, eg Racing and Shooting, will that return all games with the Racing genre and all games with the Shooting genre? Or will it return just the games with both the Racing and Shooting genres?
Is it possible to choose how the filtering works? Inclusive or Exclusive? Broad or Explicit? I don't know the best way to phrase it.
-
@mattrixk Hi!
Not at all, glad someone is happy to use this :)
The filtering is:
- UNION/JOIN in the same <category>
- INTERSECT across different <categories>
So, what this means is:
- If you select two different genres, it will show games that match either genre 1 or 2 (as a game can't have more than one genres, so doing it otherwise would always return none :) ).
- If you select two categories (say, genre and players), it will intersect both. So, if you select:
- Developer: Capcom, SNK
- Genre: Fighting
- Players: 2
- Rating: 4, 5
It will filter for Capcom or SNK fighting games for 2 players which have ratings of 4 starts or above.
I hope this helps. I wouldn't think of making this more complex unless there is a clear need/use case for it. The use case here is "you're looking for something that matches a criteria", rather than "everything that matches at least one of the parameters".
But do let me know how it goes!
-
@pjft said
as a game can't have more than one genres
Uhh... so I can't have a gamelist that looks like this:
<game id="goldnaxe"> <path>./goldnaxe.zip</path> <name>Golden Axe</name> <desc>Golden Axe is a sideways scrolling beat-em-up set in a traditional fantasy world.</desc> <image>./media-detailed/goldnaxe-detailed.png</image> <genre>Brawler, Hack-Slash, RPG, 2.5D, Golden-Axe</genre> <players>2</players> </game>
So I can then filter by all Brawlers, or by all Hack-Slash games, or all 2.5D games?
I've spent most of my free time doing that to my Genre tags so I can easily filter exactly what I want. I hope I haven't been wasting my time.
-
@mattrixk Huh.
I'm not really sure that's how these tags are meant to work, but in this case what that'll result will be in an entry for "Brawler, Hack-Slash, RPG, 2.5D, Golden-Axe" :l
The genres usually come from the scraper and are a single entry. It is "genre", not "genres" :/
At least for now that will now work as you expect it to.
Sorry for that.
-
@pjft Darn. Oh well, at least I don't have to do my whole collection that way (it would have taken a while). Cheers for letting me know. I'll have to have a play with it when I get the chance.
-
@mattrixk If your gamelist has the data saved, I'd imagine you could probably have a script turn those genres into a custom collection. So all your 2.5D games would get its own collection, Brawler would be a collection, etc. This isn't a filter, but it would give you just the games you wanted per collection.
-
@hurricanefan: I wouldn't have a clue how to make a script to do that. So far I've only made the change to a couple of systems. The plan was to then use those new genres to add a only a couple of custom collections, I didn't want too many.
Because I used a couple of different scrapers, and they all have their own Genre names (eg: Platform and Platformer), I need to clean up the Genres anyway. I figured I'd come up with my own Genre names. Here's the list I've come up with if anyone is curious:
Genre: Racing Racing-Car Racing-Kart Racing-Bike Racing-Boat Racing-Plane Racing-OffRoad Racing-Toy Racing-Demolition Racing-Hover Racing-Snow Driving Vehicular-Combat Flight-Sim Space-Sim Tank Mech Shooter Shooter-Rail Shooter-LightGun Shooter-Flight Shooter-Tunnel Action Adventure Point-Click Action-Adventure Action-RPG Hack-Slash Run-Gun RPG Platformer Platformer-3D Brawler (Beat 'Em Up) Fighter Fighter-2D Fighter-3D Sports Sports-Snow Sports-Skate Sports-Bike Sports-Blade Sports-Wrestle Sports-Baseball Sports-Soccer Sports-Tennis Sports-Football Sports-Basketball Stunts Puzzle RTS Strategy Music Rhythm Management-Sim Stealth Turn-Based Maze Shmup Shmup-Vert Shmup-Horz View: 1st-Person 3rd-Person Isometric Side-Scroller Top-Down Birds-Eye 2.5D Theme: Horror SciFi Fantasy Post-Apocalyptic Medieval Age: Kids Adult Collection: Alien Predator AvP Doom Street-Fighter Marvel X-Men Avengers Hulk FPS Rampage MegaMan SuperHero Batman Spiderman Superman DC Spawn Star-Wars Tetris Worms Mortal-Kombat LEGO Jurassic-Park Dinosaurs Punisher Pong DnD Donkey-Kong Cartoon Golden-Axe
Sure, if what I wanted to do worked, it would have made for a very large Genre Filter list, but that's a small price for being able to search for exactly what I wanted.
-
@mattrixk Wow, that is a long list. :)
-
@hurricanefan Heh, yeah... It just kind of grew. It's not a complete list, as I'm sure the "Collection" section will continue to grow as I go through more of my Gamelists.
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.