Skip to content

Commit cfddc3c

Browse files
committed
Cleanup
1 parent f0e13f4 commit cfddc3c

File tree

9 files changed

+15
-39
lines changed

9 files changed

+15
-39
lines changed

BonusTools.cs

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
1-
using BonusTools;
2-
using BonusTools.ImportFromFiles;
1+
using BonusTools.ImportFromFiles;
32
using BonusTools.JP;
43
using Playnite.SDK;
54
using Playnite.SDK.Plugins;
65
using System;
76
using System.Collections.Generic;
8-
using System.Runtime;
9-
using System.Web.UI;
10-
using Game = Playnite.SDK.Models.Game;
117

128

139
namespace BonusTools
1410
{
1511
public class BonusTools : GenericPlugin
1612
{
17-
private static readonly ILogger logger = LogManager.GetLogger();
1813
private string steamApiLanguage;
1914
private BonusSettingsViewModel settings { get; set; }
2015

@@ -46,7 +41,7 @@ public override IEnumerable<GameMenuItem> GetGameMenuItems(GetGameMenuItemsArgs
4641
{
4742
new GameMenuItem
4843
{
49-
Description = "OVERWRITE PlayCount based on the numbers of reviews on Steam/SensCritique/IGDB",
44+
Description = "Update PlayCount based on the numbers of reviews on Steam/SensCritique/IGDB",
5045
MenuSection = $"{_menuSection}",
5146
Icon = "BonusToolsUpdateIcon",
5247
Action = a => {
@@ -55,7 +50,7 @@ public override IEnumerable<GameMenuItem> GetGameMenuItems(GetGameMenuItemsArgs
5550
},
5651
new GameMenuItem
5752
{
58-
Description = "Import SensCritique.com data (Warning : OVERWRITE your UserScore and PlayCount unless disabled via Add-ons settings)",
53+
Description = "Import SensCritique.com data (OVERWRITE UserScore and PlayCount, unless disabled via settings)",
5954
MenuSection = $"{_menuSection}",
6055
Icon = "BonusToolsUpdateIcon",
6156
Action = a => {

IGDBexe/IGDBClientHelper.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
using IGDB;
22
using IGDB.Models;
3-
using Microsoft.Extensions.Logging;
4-
using Newtonsoft.Json;
5-
using System.Collections.Generic;
6-
using System;
73
using System.Linq;
8-
using System.Net;
9-
using System.Text;
104
using System.Threading.Tasks;
11-
using Playnite.SDK;
125

136
namespace BonusTools
147
{

IGDBexe/IGDBClientHelperV2.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
namespace BonusTools
1414
{
1515
public class IGDBClientHelperV2
16-
{
17-
// TODO : ask users to provide their own API key ?
16+
{
1817
// see https://api-docs.igdb.com/#getting-started
1918
private static readonly Playnite.SDK.ILogger Logger = LogManager.GetLogger();
2019
private string igdbAccessToken;

JP/ImportFromFiles/CustomSpreadsheet.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,9 @@ internal class CustomSpreadsheet
2626
{
2727
private string _file = "jpOwnedGames.xlsx";
2828
private const string tab = "Sheet1";
29-
private BonusSettings settings;
3029

3130
public CustomSpreadsheet(BonusSettings settings)
3231
{
33-
this.settings = settings;
3432
_file = settings.Custom;
3533
}
3634

JP/ImportFromFiles/PsMasterList.cs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
using ExcelDataReader;
22
using Playnite.SDK;
33
using Playnite.SDK.Models;
4-
using PlayniteUtilitiesCommon;
54
using System;
6-
using System.Collections.Generic;
75
using System.IO;
86
using System.Linq;
97
using System.Text;
10-
using System.Threading.Tasks;
11-
using static System.Net.WebRequestMethods;
128

139
namespace BonusTools
1410
{

JP/ImportFromFiles/PsPrices.cs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
11
using ExcelDataReader;
22
using Playnite.SDK;
3-
using Playnite.SDK.Models;
43
using System;
5-
using System.Collections.Generic;
64
using System.Diagnostics;
75
using System.IO;
8-
using System.Linq;
96
using System.Text;
10-
using System.Threading.Tasks;
11-
using Playnite.SDK;
127

138
namespace BonusTools
149
{

JP/Popularity/IGDB.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ namespace BonusTools
1212
{
1313
public class IGDB
1414
{
15+
private const double RATING_COUNT_MULTIPLIER = 300;
16+
1517
// this function is used to update the PlayCount and CommunityScore of a game using IGDB
1618
public static Task UpdateScores(Game playniteGame, IPlayniteAPI PlayniteApi, BonusSettings settings)
1719
{
@@ -44,7 +46,7 @@ public static Task UpdateScores(Game playniteGame, IPlayniteAPI PlayniteApi, Bon
4446
{
4547
if (gameToUpdate.PlayCount == 0)
4648
{
47-
gameToUpdate.PlayCount = (ulong)(ratingCount * 300);
49+
gameToUpdate.PlayCount = (ulong)(ratingCount * RATING_COUNT_MULTIPLIER);
4850
// 300 = to compensate with the Steam reviews since IGDB is a lot less popular
4951
// this is an arbitrary value, it could probably be higher a bit
5052
}
@@ -142,7 +144,7 @@ public static void RefreshGameData2(List<Game> games, IPlayniteAPI PlayniteApi)
142144
//Thread.Sleep(100);
143145
}
144146

145-
PlayniteApi.Dialogs.ShowMessage(ResourceProvider.GetString("LOCReview_Viewer_DialogResultsDataRefreshFinishedMessage"), "Steam Reviews Viewer");
147+
PlayniteApi.Dialogs.ShowMessage(ResourceProvider.GetString("LOCReview_Viewer_DialogResultsDataRefreshFinishedMessage"), "TEMP INVERTER");
146148
}
147149
}
148150
}

JP/Popularity/Popularity.cs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace BonusTools
1010
{
1111
internal class Popularity
1212
{
13-
// Update using Steam, fallback to IGDB
13+
// Update using Steam, fallback to SensCritique and IGDB
1414
// TODO : I update the community score when using IGDB but not when using Steam .. I need a more consistent approach
1515
public static void UpdatePlayCount(List<Game> games, IPlayniteAPI PlayniteApi, string steamApiLanguage, string dataPath, BonusSettings settings)
1616
{
@@ -37,10 +37,11 @@ public static void UpdatePlayCount(List<Game> games, IPlayniteAPI PlayniteApi, s
3737
{
3838
// TODO : probably not the most efficient way to update only the PlayCount at this stage
3939
// if we updated all fields at once, we would save time but it would be less flexible
40-
settings.UpdatePlayCountFromSensCritique = true;
41-
settings.UpdateUserScoreFromSensCritique = false;
42-
settings.AddLinkToSensCritique = false;
43-
new SensCritiqueV2(settings).UpdateGameRating(PlayniteApi, game);
40+
BonusSettings tempSettings = new BonusSettings();
41+
tempSettings.UpdatePlayCountFromSensCritique = true;
42+
tempSettings.UpdateUserScoreFromSensCritique = false;
43+
tempSettings.AddLinkToSensCritique = false;
44+
new SensCritiqueV2(tempSettings).UpdateGameRating(PlayniteApi, game);
4445
}
4546
if(game.PlayCount == 0)
4647
{

JP/SensCritiqueV2.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
using Microsoft.Extensions.Logging;
2-
using Playnite.SDK;
1+
using Playnite.SDK;
32
using Playnite.SDK.Models;
43
using System;
54
using System.Collections.Generic;
65
using System.Linq;
7-
using System.Text;
8-
using System.Threading;
96
using System.Threading.Tasks;
107
using static GraphQLServiceV2;
118

0 commit comments

Comments
 (0)