diff --git a/.github/workflows/issue_close_inactive.yml b/.github/workflows/issue_close_inactive.yml index be382ef..67ae079 100644 --- a/.github/workflows/issue_close_inactive.yml +++ b/.github/workflows/issue_close_inactive.yml @@ -15,6 +15,7 @@ jobs: actions: "close-issues" token: ${{ secrets.GITHUB_TOKEN }} inactive-day: 30 + exclude-labels: "enhancement,bug" close-reason: "not_planned" body: | This issue was closed due to inactive more than 30 days. You can reopen or recreate it if you think it should continue. diff --git a/Jellyfin.Plugin.MetaShark.Test/MovieProviderTest.cs b/Jellyfin.Plugin.MetaShark.Test/MovieProviderTest.cs index 683054f..00a2fa3 100644 --- a/Jellyfin.Plugin.MetaShark.Test/MovieProviderTest.cs +++ b/Jellyfin.Plugin.MetaShark.Test/MovieProviderTest.cs @@ -48,5 +48,26 @@ namespace Jellyfin.Plugin.MetaShark.Test }).GetAwaiter().GetResult(); } + [TestMethod] + public void TestGetMetadataAnime() + { + var info = new MovieInfo() { Name = "[SAIO-Raws] もののけ姫 Mononoke Hime [BD 1920x1036 HEVC-10bit OPUSx2 AC3]" }; + var doubanApi = new DoubanApi(loggerFactory); + var tmdbApi = new TmdbApi(loggerFactory); + var omdbApi = new OmdbApi(loggerFactory); + var httpClientFactory = new DefaultHttpClientFactory(); + var libraryManagerStub = new Mock(); + + Task.Run(async () => + { + var provider = new MovieProvider(httpClientFactory, loggerFactory, libraryManagerStub.Object, doubanApi, tmdbApi, omdbApi); + var result = await provider.GetMetadata(info, CancellationToken.None); + Assert.IsNotNull(result); + + var str = result.ToJson(); + Console.WriteLine(result.ToJson()); + }).GetAwaiter().GetResult(); + } + } } diff --git a/Jellyfin.Plugin.MetaShark.Test/ParseNameTest.cs b/Jellyfin.Plugin.MetaShark.Test/ParseNameTest.cs new file mode 100644 index 0000000..6421a13 --- /dev/null +++ b/Jellyfin.Plugin.MetaShark.Test/ParseNameTest.cs @@ -0,0 +1,133 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Jellyfin.Plugin.MetaShark.Api; +using Jellyfin.Plugin.MetaShark.Core; +using Jellyfin.Plugin.MetaShark.Model; +using Jellyfin.Plugin.MetaShark.Providers; +using Microsoft.Extensions.Logging; +using Newtonsoft.Json; + +namespace Jellyfin.Plugin.MetaShark.Test +{ + [TestClass] + public class ParseNameTest + { + ILoggerFactory loggerFactory = LoggerFactory.Create(builder => + builder.AddSimpleConsole(options => + { + options.IncludeScopes = true; + options.SingleLine = true; + options.TimestampFormat = "hh:mm:ss "; + })); + + + + [TestMethod] + public void TestMovieParse() + { + // 混合中英文 + var fileName = "新世界.New.World.2013.BluRay.1080p.x265.10bit.MNHD-FRDS"; + var parseResult = NameParser.Parse(fileName); + Console.WriteLine(parseResult.ToJson()); + + fileName = "V字仇杀队.V.for.Vendetta.2006"; + parseResult = NameParser.Parse(fileName); + Console.WriteLine(parseResult.ToJson()); + + // 只英文 + fileName = "New.World.2013.BluRay.1080p.x265.10bit.MNHD-FRDS"; + parseResult = NameParser.Parse(fileName); + Console.WriteLine(parseResult.ToJson()); + + fileName = "Who.Am.I.1998.1080p.BluRay.x264.DTS-FGT"; + parseResult = NameParser.Parse(fileName); + Console.WriteLine(parseResult.ToJson()); + + // 标题加年份 + fileName = "V字仇杀队 (2006)"; + parseResult = NameParser.Parse(fileName); + Console.WriteLine(parseResult.ToJson()); + + + // anime + fileName = "[SAIO-Raws] もののけ姫 Mononoke Hime [BD 1920x1036 HEVC-10bit OPUSx2 AC3].mp4"; + parseResult = NameParser.Parse(fileName); + Console.WriteLine(parseResult.ToJson()); + } + + [TestMethod] + public void TestTVSeriesParse() + { + // 混合中英文 + var fileName = "新世界.New.World.2013.BluRay.1080p.x265.10bit.MNHD-FRDS"; + var parseResult = NameParser.Parse(fileName); + Console.WriteLine(parseResult.ToJson()); + + // 混合中英文带副标题 + fileName = "航海王:狂热行动.One.Piece.Stampede.2019.BD720P.X264.AAC.Japanese&Mandarin.CHS.Mp4Ba"; + parseResult = NameParser.Parse(fileName); + Console.WriteLine(parseResult.ToJson()); + + // 只英文 + fileName = "She-Hulk.Attorney.at.Law.S01.1080p.WEBRip.x265-RARBG"; + parseResult = NameParser.Parse(fileName); + Console.WriteLine(parseResult.ToJson()); + + fileName = "Bright.Future.S01.2022.2160p.HDR.WEB-DL.H265.AAC-BlackTV[BTBTT]"; + parseResult = NameParser.Parse(fileName); + Console.WriteLine(parseResult.ToJson()); + + fileName = "Back.to.the.Future.Part.II.1989.BluRay.1080p.x265.10bit.2Audio-MiniHD[BTBTT]"; + parseResult = NameParser.Parse(fileName); + Console.WriteLine(parseResult.ToJson()); + + + + // anime混合中日文 + fileName = "[异域-11番小队][罗马浴场 THERMAE_ROMAE][1-6+SP][BDRIP][720P][X264-10bit_AAC]"; + parseResult = NameParser.Parse(fileName); + Console.WriteLine(parseResult.ToJson()); + + // anime + fileName = "[Nekomoe kissaten][Shin Ikkitousen][01-03][720p][CHT]"; + parseResult = NameParser.Parse(fileName); + Console.WriteLine(parseResult.ToJson()); + + fileName = "[SAIO-Raws] Fullmetal Alchemist Brotherhood [BD 1920x1080 HEVC-10bit OPUS][2009]"; + parseResult = NameParser.Parse(fileName); + Console.WriteLine(parseResult.ToJson()); + } + + [TestMethod] + public void TestEposideParse() + { + // 混合中英文 + var fileName = "新世界.New.World.2013.BluRay.1080p.x265.10bit.MNHD-FRDS"; + var parseResult = NameParser.Parse(fileName); + Console.WriteLine(parseResult.ToJson()); + + // 只英文 + fileName = "She-Hulk.Attorney.At.Law.S01E01.1080p.WEBRip.x265-RARBG"; + var anitomyResult = AnitomySharp.AnitomySharp.Parse(fileName); + Console.WriteLine(anitomyResult.ToJson()); + + parseResult = NameParser.Parse(fileName); + Console.WriteLine(parseResult.ToJson()); + + // anime + fileName = "[YYDM-11FANS][THERMAE_ROMAE][02][BDRIP][720P][X264-10bit_AAC][7FF2269F]"; + parseResult = NameParser.Parse(fileName); + Console.WriteLine(parseResult.ToJson()); + + fileName = "[WMSUB][Detective Conan - Zero‘s Tea Time ][S01][E06][BIG5][1080P].mp4"; + parseResult = NameParser.Parse(fileName); + Console.WriteLine(parseResult.ToJson()); + + + } + + } +} \ No newline at end of file diff --git a/Jellyfin.Plugin.MetaShark/Api/DoubanApi.cs b/Jellyfin.Plugin.MetaShark/Api/DoubanApi.cs index 40be599..9633027 100644 --- a/Jellyfin.Plugin.MetaShark/Api/DoubanApi.cs +++ b/Jellyfin.Plugin.MetaShark/Api/DoubanApi.cs @@ -48,6 +48,7 @@ namespace Jellyfin.Plugin.MetaShark.Api Regex regSid = new Regex(@"sid: (\d+?),", RegexOptions.Compiled); Regex regCat = new Regex(@"\[(.+?)\]", RegexOptions.Compiled); Regex regYear = new Regex(@"(\d{4})", RegexOptions.Compiled); + Regex regOriginalName = new Regex(@"原名[::](.+?)\s*?\/", RegexOptions.Compiled); Regex regDirector = new Regex(@"导演: (.+?)\n", RegexOptions.Compiled); Regex regWriter = new Regex(@"编剧: (.+?)\n", RegexOptions.Compiled); Regex regActor = new Regex(@"主演: (.+?)\n", RegexOptions.Compiled); @@ -165,6 +166,7 @@ namespace Jellyfin.Plugin.MetaShark.Api var cat = titleStr.GetMatchGroup(this.regCat); var subjectStr = movieElement.GetText("div.rating-info>.subject-cast") ?? string.Empty; var year = subjectStr.GetMatchGroup(this.regYear); + var originalName = subjectStr.GetMatchGroup(this.regOriginalName); var desc = movieElement.GetText("div.content>p") ?? string.Empty; if (cat != "电影" && cat != "电视剧") { @@ -174,7 +176,7 @@ namespace Jellyfin.Plugin.MetaShark.Api var movie = new DoubanSubject(); movie.Sid = sid; movie.Name = name; - movie.OriginalName = subjectStr.Split("/").FirstOrDefault(a => a.Contains("原名:"),"").Replace("原名:",""); + movie.OriginalName = !string.IsNullOrEmpty(originalName) ? originalName : name; movie.Genre = cat; movie.Category = cat; movie.Img = img; diff --git a/Jellyfin.Plugin.MetaShark/Configuration/configPage.html b/Jellyfin.Plugin.MetaShark/Configuration/configPage.html index 6828312..c7defac 100644 --- a/Jellyfin.Plugin.MetaShark/Configuration/configPage.html +++ b/Jellyfin.Plugin.MetaShark/Configuration/configPage.html @@ -57,7 +57,8 @@ -
填写Api域名,默认api.tmdb.org.(需重启才能生效)
+
+ 填写Api域名,可选api.tmdb.org/api.themoviedb.org,默认api.tmdb.org.(需重启才能生效)