Skip to content

Commit

Permalink
fix horimiya being detected instead of horimiya piece #33
Browse files Browse the repository at this point in the history
  • Loading branch information
insomniachi committed Aug 30, 2023
1 parent d7b83e2 commit 77ee7de
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
20 changes: 18 additions & 2 deletions Totoro.Core/Services/DiscordRichPresense.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,24 @@ public void UpdateImage(string url)
_client.UpdateSmallAsset("icon");
}
}
public void ClearTimer() => _client.UpdateClearTime();
public void Clear() => _client.ClearPresence();
public void ClearTimer()
{
if (!IsInitialized)
{
return;
}

_client.UpdateClearTime();
}
public void Clear()
{
if(!IsInitialized)
{
return;
}

_client.ClearPresence();
}
public void SetUrl(string url)
{
if(string.IsNullOrEmpty(url))
Expand Down
2 changes: 1 addition & 1 deletion Totoro.WinUI/Services/ViewService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ public async Task<T> SelectModel<T>(IEnumerable<T> models, T defaultValue = defa
return result.Id;
}

var ratios = candidates.Select(x => (x, Fuzz.PartialRatio(x.Title, title))).OrderByDescending(x => x.Item2).ToList();
var ratios = candidates.Select(x => (x, Fuzz.Ratio(x.Title, title))).OrderByDescending(x => x.Item2).ToList();
var filtered = ratios.Where(x => x.Item2 > 80).ToList();
if (filtered.Count == 1)
{
Expand Down

0 comments on commit 77ee7de

Please sign in to comment.