Skip to content

Commit 097a5a9

Browse files
committed
Add exceptions for null values on Game properties source and game id. Add id to yaml metadata.
1 parent 5883e08 commit 097a5a9

File tree

2 files changed

+23
-6
lines changed

2 files changed

+23
-6
lines changed

SGDBMetadata/SGDBMetadataProvider.cs

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,12 @@ public override MetadataFile GetCoverImage()
6565
logger.Info("GetCoverImage");
6666
if (options.IsBackgroundDownload)
6767
{
68-
var gameUrl = services.getCoverImageUrl(options.GameData.Name, convertPlayniteGameSourceToSGDBPlatformEnum(options.GameData.Source.ToString().ToLower()), options.GameData.GameId);
68+
string gameUrl;
69+
if(options.GameData.Source != null && options.GameData.GameId != null) {
70+
gameUrl = services.getCoverImageUrl(options.GameData.Name, convertPlayniteGameSourceToSGDBPlatformEnum(options.GameData.Source.ToString().ToLower()), options.GameData.GameId);
71+
} else {
72+
gameUrl = services.getCoverImageUrl(options.GameData.Name);
73+
}
6974
if(gameUrl == "bad path") {
7075
return base.GetCoverImage();
7176
} else{
@@ -108,8 +113,12 @@ public override MetadataFile GetBackgroundImage()
108113
{
109114
if (options.IsBackgroundDownload)
110115
{
111-
112-
var gameUrl = services.getHeroImageUrl(options.GameData.Name, convertPlayniteGameSourceToSGDBPlatformEnum(options.GameData.Source.ToString().ToLower()), options.GameData.GameId);
116+
string gameUrl;
117+
if(options.GameData.Source != null && options.GameData.GameId != null) {
118+
gameUrl = services.getHeroImageUrl(options.GameData.Name, convertPlayniteGameSourceToSGDBPlatformEnum(options.GameData.Source.ToString().ToLower()), options.GameData.GameId);
119+
} else {
120+
gameUrl = services.getHeroImageUrl(options.GameData.Name);
121+
}
113122
if(gameUrl == "bad path") {
114123
return base.GetBackgroundImage();
115124
} else {
@@ -152,7 +161,14 @@ public override MetadataFile GetIcon()
152161
{
153162
if (options.IsBackgroundDownload)
154163
{
155-
var gameUrl = services.getLogoImageUrl(options.GameData.Name, convertPlayniteGameSourceToSGDBPlatformEnum(options.GameData.Source.ToString().ToLower()), options.GameData.GameId);
164+
var logger = LogManager.GetLogger();
165+
logger.Info("SGDBMetadataProvider GetIcon options " + options.GameData.ToString());
166+
string gameUrl;
167+
if(options.GameData.Source != null && options.GameData.GameId != null) {
168+
gameUrl = services.getLogoImageUrl(options.GameData.Name, convertPlayniteGameSourceToSGDBPlatformEnum(options.GameData.Source.ToString().ToLower()), options.GameData.GameId);
169+
} else {
170+
gameUrl = services.getLogoImageUrl(options.GameData.Name);
171+
}
156172
if(gameUrl == "bad path") {
157173
return base.GetIcon();
158174
} else {

SGDBMetadata/extension.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
Name: SteamGridDB Metadata Provider
1+
Id: SteamGridDB_Playnite_Metadata
2+
Name: SteamGridDB Metadata Provider
23
Author: cooperate
3-
Version: 0.5.4
4+
Version: 0.5.5
45
Module: SGDBMetadata.dll
56
Type: MetadataProvider
67
Icon: icon.png

0 commit comments

Comments
 (0)