瀏覽代碼

Add EpisodeExpression for anime file names

TonyB 8 月之前
父節點
當前提交
79ee36ee15
共有 2 個文件被更改,包括 10 次插入0 次删除
  1. 8 0
      Emby.Naming/Common/NamingOptions.cs
  2. 2 0
      tests/Jellyfin.Naming.Tests/TV/EpisodeNumberTests.cs

+ 8 - 0
Emby.Naming/Common/NamingOptions.cs

@@ -467,6 +467,14 @@ namespace Emby.Naming.Common
                 {
                     IsNamed = true
                 },
+
+                // Anime style expression
+                // "[Group][Series Name][21][1080p][FLAC][HASH]"
+                // "[Group] Series Name [04][BDRIP]"
+                new EpisodeExpression(@"(?:\[(?:[^\]]+)\]\s*)?(?<seriesname>\[[^\]]+\]|[^[\]]+)\s*\[(?<epnumber>\d+)\]")
+                {
+                    IsNamed = true
+                },
             };
 
             VideoExtraRules = new[]

+ 2 - 0
tests/Jellyfin.Naming.Tests/TV/EpisodeNumberTests.cs

@@ -77,6 +77,8 @@ namespace Jellyfin.Naming.Tests.TV
         [InlineData("Season 3/The Series S3 E9 - The title.avi", 9)]
         [InlineData("Season 3/S003 E009.avi", 9)]
         [InlineData("Season 3/Season 3 Episode 9.avi", 9)]
+        [InlineData("[VCB-Studio] Re Zero kara Hajimeru Isekai Seikatsu [21][Ma10p_1080p][x265_flac].mkv", 21)]
+        [InlineData("[CASO&Sumisora][Oda_Nobuna_no_Yabou][04][BDRIP][1920x1080][x264_AAC][7620E503].mp4", 4)]
 
         // [InlineData("Case Closed (1996-2007)/Case Closed - 317.mkv", 317)] // triple digit episode number
         // TODO: [InlineData("Season 2/16 12 Some Title.avi", 16)]