Skip to content

Commit

Permalink
Fix disabling of GOG DB and Official site links when disabled in exte… (
Browse files Browse the repository at this point in the history
#80)

* Fix disabling of GOG DB and Official site links when disabled in extension options

* Fix disabling of GOG DB and Official site links when disabled in extension options
  • Loading branch information
sharkusmanch authored Mar 5, 2024
1 parent fe45e46 commit 60442d3
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion extension.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Id: PCGamingWikiMetadata_c038558e-427b-4551-be4c-be7009ce5a8d
Name: PCGamingWiki Metadata Provider
Author: sharkusmanch
Version: 1.2.4
Version: 1.2.5
Module: PCGamingWikiMetadata.dll
Type: MetadataProvider
Icon: icon.png
6 changes: 6 additions & 0 deletions manifest.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
AddonId: PCGamingWikiMetadata_c038558e-427b-4551-be4c-be7009ce5a8d
Packages:
- Version: 1.2.5
RequiredApiVersion: 6.11.0
ReleaseDate: 2024-03-04
PackageUrl: https://github.com/sharkusmanch/playnite-pcgamingwiki-metadata-provider/releases/download/v1.2.5/PCGamingWiki_Metadata_Provider_v1.2.5.pext
Changelog:
- Fix disabling of GOG DB and Official site links via extension settings
- Version: 1.2.4
RequiredApiVersion: 6.11.0
ReleaseDate: 2024-02-16
Expand Down
4 changes: 2 additions & 2 deletions src/PCGamingWikiHTMLParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -392,10 +392,10 @@ private void AddLinks(HtmlNode icons)
switch (c.Attributes["Title"].Value)
{
case var title when new Regex(@"^Official site$").IsMatch(title):
this.gameController.Game.Links.Add(new Playnite.SDK.Models.Link("Official site", url));
this.gameController.AddLink(new Playnite.SDK.Models.Link("Official site", url));
break;
case var title when new Regex(@"GOG Database$").IsMatch(title):
this.gameController.Game.Links.Add(new Playnite.SDK.Models.Link("GOG Database", url));
this.gameController.AddLink(new Playnite.SDK.Models.Link("GOG Database", url));
break;
default:
string[] linkTitle = c.Attributes["Title"].Value.Split(' ');
Expand Down
2 changes: 2 additions & 0 deletions tests/PCGWGame_Test_BAT.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public PCGWGame_Test_BAT()
this.client.GetSettings().ImportFeatureVR = true;
this.client.GetSettings().ImportTagMonetization = true;
this.client.GetSettings().ImportTagMicrotransactions = true;
this.client.GetSettings().ImportLinkGOGDatabase = false;
this.client.FetchGamePageContent(this.testGame);
}

Expand Down Expand Up @@ -180,6 +181,7 @@ public void TestLinks()
{
var links = this.testGame.Links.Select(i => i.Name).ToArray();
links.Should().NotContain("WineHQ");
links.Should().NotContain("GOG Database");
links.Should().Contain("IGDB");
}

Expand Down
10 changes: 9 additions & 1 deletion tests/PCGWGame_Test_CITIES.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
public class PCGWGame_Test_CITIES : IDisposable
{
private PCGWGame testGame;
private PCGWClient client;
private LocalPCGWClient client;
private TestMetadataRequestOptions options;

public PCGWGame_Test_CITIES()
Expand All @@ -16,6 +16,7 @@ public PCGWGame_Test_CITIES()
this.options = new TestMetadataRequestOptions();
this.options.SetGameSourceSteam();
this.client = new LocalPCGWClient(this.options);
this.client.GetSettings().ImportLinkOfficialSite = false;
this.client.FetchGamePageContent(this.testGame);
}

Expand Down Expand Up @@ -119,6 +120,13 @@ public void TestControllerSupport()
features.Should().NotContain("Full Controller Support");
}

[Fact]
public void TestLinks()
{
var features = this.testGame.Links.Select(i => i.Name).ToArray();
features.Should().NotContain("Official site");
}

[Fact]
public void TestVR()
{
Expand Down

0 comments on commit 60442d3

Please sign in to comment.