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

[Feature Request] Overhaul SteamGridDB Integration #933

Closed
11 tasks done
sonic2kk opened this issue Oct 9, 2023 · 12 comments · Fixed by #934, #958, #938, #944 or #957
Closed
11 tasks done

[Feature Request] Overhaul SteamGridDB Integration #933

sonic2kk opened this issue Oct 9, 2023 · 12 comments · Fixed by #934, #958, #938, #944 or #957
Labels
enhancement New feature or request Initiative Issues detailing a significant set of features/enhancements

Comments

@sonic2kk
Copy link
Owner

sonic2kk commented Oct 9, 2023

System Information

  • SteamTinkerLaunch version: 14.0.20231010-1
  • Distribution: Arch Linux

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.

  • For Steam games, we hit https://www.steamgriddb.com/api/v2/grids/steam/<steam_appid>
  • For Non-Steam Games (when we add them via "Add Non-Steam Game"), we can take the SteamGridDB Game ID and then hit https://www.steamgriddb.com/api/v2/grids/game
  • In both cases, we only fetch the most popular, but this is expected behaviour

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.

  • icon is also a valid endpoint, but only available for Non-Steam Games. Steam does allow you to temporarily overwrite this, but Steam will update it again itself, as this is stored in a cache
  • tenfoot is not available, but more on that later

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

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 <id>)
      • 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

  • Overhaul UI/backend to allow fetching game hero, logo, boxart (and icons for Non-Steam Games)
  • Add options to allow automatic creation of a tenfoot since we can't get it from SteamGridDB
  • Update relevant wiki pages (SteamGridDB, Add Non-Steam Game, Set Game Artwork)
  • Update commandline usage help screens to note the new functionality as it is added
  • Update commandline to change default behaviour to accept AppID, using any per-game SteamGridDB Game ID if specified in the per-game config file, and otherwise falling back to the AppID
  • Add textbox on Game Menu to optionally specify SteamGridDB Game ID (irrelevant, though if someone really wants it they can submit a PR)
  • Add command to take in SteamGridDB API token (command already exists)

Part 2

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

  • Add command for searching for SteamGridDB Game ID by name
  • Allow entering Steam AppID when adding Non-Steam Games
  • Add command to remove all grids or per-game grids
  • Add retry/timeout to SteamGridDB requests
  • Add GUI for setting SteamGridDB artwork per-game (steamtinkerlaunch sgdb wiithout options should open a Yad window where a user can enter information for the SteamGridDB commandline fetcher function, with options to select which artwork they want to download as well, and options to enter the Steam AppID/Game ID etc -- Essentially a frontend for the sgdb command)
  • Add option to add artwork for all Non-Steam Games in shortcuts.vdf (can get all Steam Shortcut AppIDs using this gist I wrote up)
  • Add command to clean up grids stored by SteamTinkerLaunch in its config folder (this would be a good thing to implement more broadly, to clean up STL downloaded files, would potentially be more useful as going into the cache folder once STL stores non-config data in ~/.config #486 is implemented)
@sonic2kk sonic2kk added the enhancement New feature or request label Oct 9, 2023
@sonic2kk sonic2kk added the Initiative Issues detailing a significant set of features/enhancements label Oct 9, 2023
@sonic2kk
Copy link
Owner Author

sonic2kk commented Oct 10, 2023

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

@sonic2kk
Copy link
Owner Author

sonic2kk commented Oct 10, 2023

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 😅

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

  • Maybe something like steamtinkerlaunch getsteamgriddbartwork single --search-id="" --blah --blah, with alternative options owned and installed which will manage all owned and installed options, and instead of calling commandlineGetSteamGridDBArtwork they will call getGridsForOwnedGames and getGridsForInstalledGames).

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
Copy link
Owner Author

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
Copy link
Owner Author

Tenfoot can be handled with the same grid endpoint, but with different dimension parameters. See #934 (comment) -- Very glad that this should work out to be much simpler than anticipated!

@sonic2kk
Copy link
Owner Author

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
Copy link
Owner Author

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:

  • Add checkbox for SteamGridDB artwork
  • Add textbox for Steam AppID to search on
  • Keep textbox for SteamGridDB AppID

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
Copy link
Owner Author

sonic2kk commented Oct 17, 2023

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
Copy link
Owner Author

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:

  • Download hero, logo, boxart, tenfoot artwork for single game, all installed games, or all owned games
  • Download artwork for a single game with a commandline function either using the Steam AppID or the SteamGridDB Game ID
  • Set filters for each of these different artworks on the Global Menu
  • Download hero, logo, boxart, and tenfoot by SteamGridDB Game ID when adding a Non-Steam Game

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

  • Command to search SteamGridDB for its Game ID
  • Option to search on Steam AppID when adding Non-Steam Games
  • Option to search on Game Name when adding Non-Steam Games (will fetch best-match SteamGridDB Game ID if found and hit the SGDB endpoint with that)
  • GUI frontend for the commandline option to download artwork from SteamGridDB
  • Command to add artwork for all Steam shortcuts in shortcuts.vdf (this may go in a separate issue, as this will be far down the road when we can get a list of all Steam shortcut AppIDs)

But overall there has been big progress here!

@sonic2kk
Copy link
Owner Author

sonic2kk commented Oct 23, 2023

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
Copy link
Owner Author

sonic2kk commented Nov 7, 2023

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
Copy link
Owner Author

sonic2kk commented Jan 5, 2024

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
Copy link
Owner Author

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 :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment