Skip to content

Commit

Permalink
Reorganize and separate code
Browse files Browse the repository at this point in the history
  • Loading branch information
mtkennerly committed Jun 8, 2024
1 parent e801df5 commit fb24080
Show file tree
Hide file tree
Showing 10 changed files with 1,086 additions and 959 deletions.
27 changes: 19 additions & 8 deletions src/Api.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
using Playnite.SDK;
using Playnite.SDK.Models;
using System.Linq;
using System.Diagnostics;
using System.Text;

namespace LudusaviPlaynite.Api
{
/// <summary>
/// Used for running Ludusavi's `api` command.
/// </summary>
public class Runner
{
ILogger logger;
Expand Down Expand Up @@ -73,20 +74,30 @@ public Runner(ILogger logger, LudusaviPlayniteSettings settings)
}
}

public void FindTitle(Game game, string name, bool hasAltTitle)
public void FindTitle(Game game)
{
var names = new List<string> { name };
var names = new List<string> { settings.GetGameNameWithAlt(game) };
int? steamId = null;
var normalized = false;

if (!Etc.IsOnPc(game) && settings.RetryNonPcGamesWithoutSuffix)
if (settings.AlternativeTitle(game) == null)
{
names.Add(game.Name);
// The Steam ID would take priority over an alt title.

steamId = Etc.SteamId(game);
normalized = settings.RetryUnrecognizedGameWithNormalization;

if (!Etc.IsOnPc(game) && settings.RetryNonPcGamesWithoutSuffix)
{
names.Add(game.Name);
}
}

var inner = new Requests.FindTitle
{
names = names,
steamId = Etc.SteamId(game),
normalized = this.settings.RetryUnrecognizedGameWithNormalization,
steamId = steamId,
normalized = normalized,
};

var request = new Request
Expand Down
Loading

0 comments on commit fb24080

Please sign in to comment.