mirror of
https://github.com/jellyfin/jellyfin-plugin-anidb.git
synced 2024-11-23 05:49:41 +00:00
Initialize searchRegex once, replace \d with [0-9]
This commit is contained in:
parent
1012564d34
commit
791fe4b76c
@ -126,9 +126,10 @@ namespace Jellyfin.Plugin.AniDB.Providers
|
||||
string xml = File.ReadAllText(GetAnidbXml());
|
||||
string s = "-";
|
||||
int x = 0;
|
||||
Regex searchRegex = new Regex(@"<anime aid=""([0-9]+)"">(?>[^<>]+|<(?!\/anime>)[^<>]*>)*?.*" + FuzzyRegexEscape(ShortenString(name, 6, 20)), RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||
while (!string.IsNullOrEmpty(s))
|
||||
{
|
||||
s = OneLineRegex(new Regex(@"<anime aid=""(\d+)"">(?>[^<>]+|<(?!\/anime>)[^<>]*>)*?.*" + FuzzyRegexEscape(ShortenString(name, 6, 20)), RegexOptions.IgnoreCase | RegexOptions.Compiled), xml, 1, x);
|
||||
s = OneLineRegex(searchRegex, xml, 1, x);
|
||||
if (s != "")
|
||||
{
|
||||
results.Add(s);
|
||||
@ -163,6 +164,7 @@ namespace Jellyfin.Plugin.AniDB.Providers
|
||||
string xml = File.ReadAllText(GetAnidbXml());
|
||||
int lowestDistance = Plugin.Instance.Configuration.TitleSimilarityThreshold;
|
||||
string currentId = "";
|
||||
|
||||
foreach (string id in results)
|
||||
{
|
||||
string nameXmlFromId = OneLineRegex(new Regex(@"<anime aid=""" + id + @"""((?s).*?)<\/anime>", RegexOptions.Compiled), xml);
|
||||
|
Loading…
Reference in New Issue
Block a user