Skip to content

Instantly share code, notes, and snippets.

@syaifulnizamyahya
Forked from bburky/README.md
Last active July 28, 2019 11:28
Show Gist options
  • Select an option

  • Save syaifulnizamyahya/918dd2be3afa3544de3e0347954c7632 to your computer and use it in GitHub Desktop.

Select an option

Save syaifulnizamyahya/918dd2be3afa3544de3e0347954c7632 to your computer and use it in GitHub Desktop.
Get Steam Cover Images Playnite Extension

Get Steam Cover Images Playnite Extension

This is a fork of extension created by Blake Burkhart. Updated for Playnite 5.0.

Replaces the cover image of the selected games with the Steam header image for the game. If the game is not a Steam game, the game's links will be parsed for a Steam store link to guess the game's AppID.

Setting game's covers to an internet URL may be slow to load, so enabling "Asynchronous image loading" in Playnite's settings is suggested.

To install, extract the downloaded extension to \Playnite-install-path\Extensions\ folder. Start Playnite >> click playnite icon >> Extension >> Reload Scripts. You should see "Get Steam Header Images for Selected Games" option under Extension. If not, restart Playnite and you should see it under Extension. Select all the games that you want to update with steam banner, then click the "Get Steam Header Images for Selected Games" extension. After a while(of not responding Playnite), the images should be updated with Steam banner.

Name: Get Steam Cover Images
Author: Blake Burkhart
Version: 0.1.1
Module: steam-header-covers.ps1
Type: Script
Functions:
- Description: Get Steam Header Images for Selected Games
FunctionName: Update-SelectedGameCovers
$steamGuid = [Guid]"CB91DFC9-B977-43BF-8E70-55F46E410FAB"
$HEADER_URL = "http://cdn.akamai.steamstatic.com/steam/apps/{0}/header.jpg"
Function Update-GameCovers ($games) {
foreach ($game in $games) {
$appid = $null
if ($game.PluginId -eq $steamGuid) {
# Use GameId for Steam games
$appid = $game.GameId
} else {
# Look for a Link to a Steam Store URL for other games
foreach ($link in $game.Links) {
switch -regex ($link.Url) {
"https?://store.steampowered.com/app/(\d+)" {
$appid = $matches[1]
}
}
}
}
if (!$appid) {
continue
}
# Verify that the URL doesn't 404
$url = $HEADER_URL -f $appid
try {
Invoke-RestMethod -Method Head -Uri $url
} catch {
continue
}
$game.CoverImage = $url
$PlayniteApi.Database.Games.Update($game)
}
}
function global:Update-SelectedGameCovers {
$selected = $PlayniteApi.MainView.SelectedGames
$updated = Update-GameCovers $selected
$PlayniteApi.Dialogs.ShowMessage("Updated cover image of $($updated.count) of $($selected.count) games.", "Update Complete")
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment