Fix parse name error
This commit is contained in:
parent
192865c7e1
commit
54e9288dfa
|
@ -42,6 +42,9 @@ namespace Jellyfin.Plugin.MetaShark.Test
|
|||
|
||||
indexNumber = provider.GuessEpisodeNumber("Fullmetal Alchemist Brotherhood.E05.1920X1080");
|
||||
Assert.AreEqual(indexNumber, 5);
|
||||
|
||||
indexNumber = provider.GuessEpisodeNumber("[SAIO-Raws] Neon Genesis Evangelion 05 [BD 1440x1080 HEVC-10bit OPUSx2 ASSx2].mkv");
|
||||
Assert.AreEqual(indexNumber, 5);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
<PackageReference Include="MSTest.TestAdapter" Version="2.2.8" />
|
||||
<PackageReference Include="MSTest.TestFramework" Version="2.2.8" />
|
||||
<PackageReference Include="coverlet.collector" Version="3.1.2" />
|
||||
<PackageReference Include="Jellyfin.Controller" Version="10.8.0" />
|
||||
<PackageReference Include="Jellyfin.Model" Version="10.8.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
@ -354,7 +354,7 @@ namespace Jellyfin.Plugin.MetaShark.Api
|
|||
list.Add(celebrity);
|
||||
}
|
||||
|
||||
_memoryCache.Set<List<DoubanCelebrity>>(cacheKey, list.Take(15).ToList(), expiredOption);
|
||||
_memoryCache.Set<List<DoubanCelebrity>>(cacheKey, list, expiredOption);
|
||||
return list;
|
||||
}
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ namespace Jellyfin.Plugin.MetaShark.Core
|
|||
var match = reg.Match(text);
|
||||
if (match.Success && match.Groups.Count > 1)
|
||||
{
|
||||
return match.Groups[1].Value;
|
||||
return match.Groups[1].Value.Trim();
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
|
|
|
@ -78,6 +78,7 @@ namespace Jellyfin.Plugin.MetaShark.Providers
|
|||
// 修正anime命名格式导致的episodeNumber错误
|
||||
var fileName = Path.GetFileName(info.Path) ?? string.Empty;
|
||||
var newEpisodeNumber = this.GuessEpisodeNumber(fileName);
|
||||
this.Log("GuessEpisodeNumber: fileName: {0} episodeNumber: {1}", fileName, newEpisodeNumber);
|
||||
if (newEpisodeNumber.HasValue && newEpisodeNumber != episodeNumber)
|
||||
{
|
||||
episodeNumber = newEpisodeNumber;
|
||||
|
@ -88,7 +89,6 @@ namespace Jellyfin.Plugin.MetaShark.Providers
|
|||
ParentIndexNumber = seasonNumber,
|
||||
IndexNumber = episodeNumber
|
||||
};
|
||||
this.Log("GuessEpisodeNumber: fileName: {0} episodeNumber: {1}", fileName, newEpisodeNumber);
|
||||
}
|
||||
|
||||
|
||||
|
@ -156,14 +156,17 @@ namespace Jellyfin.Plugin.MetaShark.Providers
|
|||
episodeIndex = result.Value.ToInt();
|
||||
}
|
||||
|
||||
foreach (var regex in EpisodeFileNameRegex)
|
||||
if (!episodeIndex.HasValue)
|
||||
{
|
||||
if (!regex.IsMatch(fileName))
|
||||
continue;
|
||||
if (!int.TryParse(regex.Match(fileName).Groups[1].Value.Trim('.'), out var index))
|
||||
continue;
|
||||
episodeIndex = index;
|
||||
break;
|
||||
foreach (var regex in EpisodeFileNameRegex)
|
||||
{
|
||||
if (!regex.IsMatch(fileName))
|
||||
continue;
|
||||
if (!int.TryParse(regex.Match(fileName).Groups[1].Value.Trim('.'), out var index))
|
||||
continue;
|
||||
episodeIndex = index;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (episodeIndex > 1000)
|
||||
|
|
|
@ -140,7 +140,7 @@ namespace Jellyfin.Plugin.MetaShark.Providers
|
|||
result.Item = movie;
|
||||
result.QueriedById = true;
|
||||
result.HasMetadata = true;
|
||||
subject.Celebrities.ForEach(c => result.AddPerson(new PersonInfo
|
||||
subject.Celebrities.Take(this._config.MaxCastMembers).ToList().ForEach(c => result.AddPerson(new PersonInfo
|
||||
{
|
||||
Name = c.Name,
|
||||
Type = c.RoleType,
|
||||
|
|
|
@ -122,7 +122,7 @@ namespace Jellyfin.Plugin.MetaShark.Providers
|
|||
|
||||
result.Item = movie;
|
||||
result.HasMetadata = true;
|
||||
subject.Celebrities.ForEach(c => result.AddPerson(new PersonInfo
|
||||
subject.Celebrities.Take(this._config.MaxCastMembers).ToList().ForEach(c => result.AddPerson(new PersonInfo
|
||||
{
|
||||
Name = c.Name,
|
||||
Type = c.RoleType,
|
||||
|
|
|
@ -139,7 +139,7 @@ namespace Jellyfin.Plugin.MetaShark.Providers
|
|||
result.Item = item;
|
||||
result.QueriedById = true;
|
||||
result.HasMetadata = true;
|
||||
subject.Celebrities.ForEach(c => result.AddPerson(new PersonInfo
|
||||
subject.Celebrities.Take(this._config.MaxCastMembers).ToList().ForEach(c => result.AddPerson(new PersonInfo
|
||||
{
|
||||
Name = c.Name,
|
||||
Type = c.RoleType,
|
||||
|
|
Loading…
Reference in New Issue