sonic2kk / steamtinkerlaunch

Linux wrapper tool for use with the Steam client for custom launch options and 3rd party programs
GNU General Public License v3.0
2.19k stars 73 forks source link

[Feature Request] Overhaul SteamGridDB Integration #933

Closed sonic2kk closed 10 months ago

sonic2kk commented 1 year ago

System Information

Feature Description

(expansion of #906)

Current Behaviour

The SteamGridDB settings right now, for both Steam games and Non-Steam Games, will download only the images available at SteamGridDB's grid endpoint.

This grid endpoint only returns the game boxart, so we aren't giving the user any way to fetch the hero or logo artwork. This does limit the usefulness of the feature.

Proposed Enhancements

This is already implemented, so I'm putting it behind a spoiler. The implementation turned out to be simpler than this and so ended up changing, but I'm keeping it here for legacy :-) The remaining work is covered in the todos and the PRs linked to this issue.

Legacy Implementation Details The idea is to allow SteamTinkerLaunch to download more game artworks from SteamGridDB. To do this would require an overhaul of the internals of how we do this, as well as a GUI overhaul. Right now, on the Global Menu we have a basic set of options that look as below, but we will expand upon this to allow more functionality when using SteamGridDB. ![image](https://github.com/sonic2kk/steamtinkerlaunch/assets/7917345/7a65941a-d9d4-4714-b124-48c5e30a821d) To enhance the functionality, we should do the following - Update code to be able to fetch SteamGridDB artwork based on - Expand the **Global Menu**'s SteamGridDB options to include checkboxes, dimensions, categories etc for each image type. - This would encompass the following: - Logo - Hero - Banner - (Non-Steam Game Only) Icon - We should include an option to toggle each of these with them all enabled by default. - We need an option to specify dimensions etc for EACH of these, as a user may want that flexibility. - We should prioritise the recommended Steam dimensions. - Update commandline usage to integrate with these overhauls - These toggles will be stored as global variables, so commandline usage should pick this up by default when calling the functions to get the artwork, which should be responsible for checking and fetching the relevant artworks based on these global variable values. - We should consider breaking this out from being a sub-argument for `steamtinkerlaunch update` and make it its own `steamgriddb` command, essentially overhauling commandline usage. We could keep the existing logic but also add an alias, to preserve compatibility. It may be a big burden to do this, so simply picking one or the other may be best. - On the commandline we should also accept the Game ID when running the command to get SteamGridDB artwork, so it can be updated without having to launch STL explicitly (i.e. `steamtinkerlaunch update grid `) - This command currently updates either OWNED or INSTALLED games (defaults to `installed`), but THIS SHOULD BE CHANGED to instead only download artwork for the current game by default, or a custom Steam AppID/Game ID, and then allowing owned/installed. We could simply add a separate command that will accept these arguments, so when `steamtinkerlaunch update grid` is used, we will use installed/owned, otherwise we can take AppID. Though keeping the wiki in sync here would be a pain! - Default should be the current game, and if no game is specified to the command, error out and exit (on the UI, we should try default to passing the command the current game ID/SteamGridDB Game ID, prioritising the SteamGridDB Game ID and only passing AppID if that is not specified) - Add command to set the SteamGridDB API token (perhaps under the existing `update` block?) - Add textbox on the **Game Menu** to optionally specify the SteamGridDB Game ID to fetch artwork on - This allows overriding the artwork for a specific game, for example if you want the same artwork for, say, two different editions of the same game. - We do NOT need to integrate with Set Game Artwork, as we already have a command for setting Game Artwork - Though this should be updated to accept the SteamGridDB Game ID, otherwise fall back to the AppID. - Update Set Game Artwork wiki page to note how to integrate with SteamGridDB, with a link to that wiki page - Ensure these changes apply to Steam and Non-Steam Games - Both by allowing Non-Steam Games to download and set artwork via STL, and on Add Non-Steam Games - Currently, the SteamGridDB options don't work at all with Non-Steam Games excluding optionally fetching boxart by Game ID when running "Add Non-Steam Game" - By allowing the option to pass the SteamGridDB Game ID on the Game Menu, we should be able to allow them to work - Add dropdown to manage how the user wants to specify a tenfoot (recently played banner image), with the following options: - Dropdown: Use Grid Artwork as Tenfoot - None (default) - Hero - Boxart - Logo - Checkbox: Resize Tenfoot Grid - Default: Unchecked - Dropdown Combobox: Tenfoot Dimensions - Default to `600x350` (Valve recommended dimensions) - Split text on `x` in `0x0` - Update/Overhaul SteamGridDB wiki page to document functionality and usage

This is a pretty big overhaul and will likely be completed in stages, which I will attempt to outline below. We can use this to track the progress of implementation.

Part 1

Part 2

These changes can be worked on after #934 is merged.

sonic2kk commented 1 year ago

Started some initial work on this, will get a draft PR up soon oh boy this is a task...

sonic2kk commented 1 year ago

There is a massively in-flux branch over at steamgriddb-overhaul. Right now it only can download artwork for Steam and Non-Steam games, but only Non-Steam Game artwork is hooked up. The functions to get grids for ALL installed or ALL owned Steam games is also hooked up to use this, but of course I have not tested this :sweat_smile:

Right now, the artwork does not at all respect the preferences selected by the user in the Global Menu, as those preferences only apply to grid artwork (boxart). We still need to overhaul the Global Menu SteamGridDB options to select things like dimensions, styles, etc. This is probably going to be a massive overhaul. Once we have these, they'll be saved as preferences on the Global Menu, so we can just slot these in when making the call in commandlineGetSteamGridDBArtwork.

We need as well a way to wire this function up to the commandline, which will probably involve a massive overhaul of our SteamGridDB commandline options to group the actions together as much as possible

And finally, we need a way to get icons for Non-Steam Games. This can really only be done at time of adding Non-Steam Games right now, as we have no way to update an entry of the shortcuts VDF file right now (icon is stored as a string field in shortcuts.vdf, which is the path to the icon). We'll probably make a separate function to download the icon and return the path, though, so we can use it in addNonSteamGame (we fetch artwork before writing out to shortcuts.vdf, so we can overwrite the shortcut variable value with it so we write out the downloaded icon path).


So still lots of work to do here, but things are moving now.

sonic2kk commented 1 year ago

When completed, #934 will probably accomplish everything in this issue. Just with how things worked out, I guess it never ended up being split into multiple PRs like I had hoped/envisioned.

sonic2kk commented 1 year ago

Tenfoot can be handled with the same grid endpoint, but with different dimension parameters. See https://github.com/sonic2kk/steamtinkerlaunch/pull/934#issuecomment-1764864657 -- Very glad that this should work out to be much simpler than anticipated!

sonic2kk commented 1 year ago

I had an idea to add an option for fetching all artwork for Non-Steam games as well, it's on the todo for #934 but will probably go in a separate PR, as we'll need a way to parse all known Non-Steam Game AppIDs from the shortcuts.vdf.

sonic2kk commented 1 year ago

There was another idea I had about potentially allowing searching on Game Name on SteamGridDB. This would be tricky as we'd have to pick the first game name that matches, so for the commandline it should be an optional parameter instead of --search-id, and for Non-Steam Games we'd do a UI revamp:

If both textboxes are blank, we will use the name entered in the Non-Steam Game Name field (same goes for commandline). We'd also update the commandline options accordingly.

sonic2kk commented 1 year ago

Did some more tests with the SteamGridDB search endpoint and it seems pretty reliable! I tested with Touhou 6 (which has various names and it worked no matter what name I entered) and Brutal Legend (which has a special character). I also tested with "Sonic Adventure™ 2" (which is the name Steam uses) and "NieR:Automata", which worked.

I did have an issue with "NieR:Replicant", which returned success but no data. However, the same thing happens when I search for that game on SteamGridDB's website, so it's not something we need to worry about.

When this is added and when the wiki is updated to document this, we should note to users that the name has to be exact if they want exact matches, for example "The Elder Scrolls IV: Oblivion" is NOT equivalent to "The Elder Scrolls IV: Oblivion Game of the Year Edition".

In short, searching by game name is more than feasible it seems. Huge props to SteamGridDB for having such useful and robust endpoints.

sonic2kk commented 1 year ago

The initial work for this was merged in #934 ! We now have a much more streamlined SteamGridDB integration and we can now do the following:

The next pieces of work will be quality of life enhancements on top of this:

But overall there has been big progress here!

sonic2kk commented 1 year ago

Some good work has been done on this. We now have timeout/retries for pinging SteamGridDB, and we can search on Game Name and Steam AppID when adding Non-Steam Games. Now it is really frictionless to use SteamGridDB artwork when adding Non-Steam Games!

Now we need a frontend for commandlineGetSteamGridDBArtwork, and a command to set artwork for all Non-Steam Games in shortcuts.vdf. We could also extend this further by having an option to list Non-Steam Game AppIDs, so a user can run steamtinkerlaunch getid <non-steam game name>. This would make it easier if a user wants to add artwork for a Non-Steam Game after-the-fact, combined with the commandlineGetSteamGridDBArtwork frontend GUI option. Being able to easily get the AppID of a Non-Steam Game will make it easier to retroactively set artwork, and two good ways to do this are by having the command to set artwork for all shortcuts, and by integrating getid with Non-Steam Games.

sonic2kk commented 1 year ago

Command to download grids for all Non-Steam Games was added in #963. The only remaining bit of work for this issue is the frontend GUI for fetching SteamGridDB artwork.

sonic2kk commented 10 months ago

New year, time to finally close this issue out. Begun work on the GUI frontend for the SteamGridDB command, basically allowing a frontend to enter the information to pass to the command. Unsure how to structure the UI just yet, but we're getting there.

Once implemented, the wiki should also be updated to show this new functionality.

sonic2kk commented 10 months ago

The SteamGridDB Overhaul is finally fully complete after many months of work! Thanks to all who suggested improvements and tested. This is one of the most significant initiatives STL has seen in recent times, and has the most user-facing impact. I hope this is useful for users :-)