diff options
| author | BaronGreenback <jimcartlidge@yahoo.co.uk> | 2020-10-17 15:00:43 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-10-17 15:00:43 +0100 |
| commit | 63be65dd919f1e628452c64f0fae7a7f035bce96 (patch) | |
| tree | 8bf19d708cef1f5667ec938ab704859b223d0d97 /Emby.Naming/AudioBook/AudioBookFilePathParser.cs | |
| parent | 68de105dc21f4d1114a3b1db81f177caae747ef6 (diff) | |
| parent | 49ac4c4044b1777dc3a25544aead7b0b15b953e8 (diff) | |
Merge branch 'master' into Comment1
Diffstat (limited to 'Emby.Naming/AudioBook/AudioBookFilePathParser.cs')
| -rw-r--r-- | Emby.Naming/AudioBook/AudioBookFilePathParser.cs | 26 |
1 files changed, 4 insertions, 22 deletions
diff --git a/Emby.Naming/AudioBook/AudioBookFilePathParser.cs b/Emby.Naming/AudioBook/AudioBookFilePathParser.cs index 3c874c62c..14edd6492 100644 --- a/Emby.Naming/AudioBook/AudioBookFilePathParser.cs +++ b/Emby.Naming/AudioBook/AudioBookFilePathParser.cs @@ -1,6 +1,6 @@ +#nullable enable #pragma warning disable CS1591 -using System; using System.Globalization; using System.IO; using System.Text.RegularExpressions; @@ -19,12 +19,7 @@ namespace Emby.Naming.AudioBook public AudioBookFilePathParserResult Parse(string path) { - if (path == null) - { - throw new ArgumentNullException(nameof(path)); - } - - var result = new AudioBookFilePathParserResult(); + AudioBookFilePathParserResult result = default; var fileName = Path.GetFileNameWithoutExtension(path); foreach (var expression in _options.AudioBookPartsExpressions) { @@ -50,27 +45,14 @@ namespace Emby.Naming.AudioBook { if (int.TryParse(value.Value, NumberStyles.Integer, CultureInfo.InvariantCulture, out var intValue)) { - result.ChapterNumber = intValue; + result.PartNumber = intValue; } } } } } - /*var matches = _iRegexProvider.GetRegex("\\d+", RegexOptions.IgnoreCase).Matches(fileName); - if (matches.Count > 0) - { - if (!result.ChapterNumber.HasValue) - { - result.ChapterNumber = int.Parse(matches[0].Groups[0].Value); - } - - if (matches.Count > 1) - { - result.PartNumber = int.Parse(matches[matches.Count - 1].Groups[0].Value); - } - }*/ - result.Success = result.PartNumber.HasValue || result.ChapterNumber.HasValue; + result.Success = result.ChapterNumber.HasValue || result.PartNumber.HasValue; return result; } |
