aboutsummaryrefslogtreecommitdiff
path: root/Emby.Naming/Video
diff options
context:
space:
mode:
authorBond-009 <bond.009@outlook.com>2021-01-24 14:11:48 +0100
committerGitHub <noreply@github.com>2021-01-24 14:11:48 +0100
commit3806cc5b3ff3633d66d96e990fd26c7db8365cd5 (patch)
tree271c3db7e5b3c89074d236a4d960f01c64643195 /Emby.Naming/Video
parentb4d04f9ca5345c87d44993fbbb9e211c1dbf2dcd (diff)
parent956ca0e5aa74fc78aa630e73a764861121ef920a (diff)
Merge pull request #5074 from jellyfin/cov
100% branch coverage for Jellyfin.Naming
Diffstat (limited to 'Emby.Naming/Video')
-rw-r--r--Emby.Naming/Video/VideoListResolver.cs13
-rw-r--r--Emby.Naming/Video/VideoResolver.cs4
2 files changed, 8 insertions, 9 deletions
diff --git a/Emby.Naming/Video/VideoListResolver.cs b/Emby.Naming/Video/VideoListResolver.cs
index fd16774739..09a030d2de 100644
--- a/Emby.Naming/Video/VideoListResolver.cs
+++ b/Emby.Naming/Video/VideoListResolver.cs
@@ -185,8 +185,8 @@ namespace Emby.Naming.Video
if (!string.IsNullOrEmpty(folderName)
&& folderName.Length > 1
&& videos.All(i => i.Files.Count == 1
- && IsEligibleForMultiVersion(folderName, i.Files[0].Path))
- && HaveSameYear(videos))
+ && IsEligibleForMultiVersion(folderName, i.Files[0].Path))
+ && HaveSameYear(videos))
{
var ordered = videos.OrderBy(i => i.Name).ToList();
@@ -216,10 +216,9 @@ namespace Emby.Naming.Video
return videos.Select(i => i.Year ?? -1).Distinct().Count() < 2;
}
- private bool IsEligibleForMultiVersion(string folderName, string? testFilename)
+ private bool IsEligibleForMultiVersion(string folderName, string testFilePath)
{
- testFilename = Path.GetFileNameWithoutExtension(testFilename) ?? string.Empty;
-
+ string testFilename = Path.GetFileNameWithoutExtension(testFilePath);
if (testFilename.StartsWith(folderName, StringComparison.OrdinalIgnoreCase))
{
if (CleanStringParser.TryClean(testFilename, _options.CleanStringRegexes, out var cleanName))
@@ -233,8 +232,8 @@ namespace Emby.Naming.Video
}
return string.IsNullOrEmpty(testFilename)
- || testFilename[0].Equals('-')
- || testFilename[0].Equals('_')
+ || testFilename[0] == '-'
+ || testFilename[0] == '_'
|| string.IsNullOrWhiteSpace(Regex.Replace(testFilename, @"\[([^]]*)\]", string.Empty));
}
diff --git a/Emby.Naming/Video/VideoResolver.cs b/Emby.Naming/Video/VideoResolver.cs
index d7165d8d7f..619d1520e4 100644
--- a/Emby.Naming/Video/VideoResolver.cs
+++ b/Emby.Naming/Video/VideoResolver.cs
@@ -125,7 +125,7 @@ namespace Emby.Naming.Video
/// <returns>True if is video file.</returns>
public bool IsVideoFile(string path)
{
- var extension = Path.GetExtension(path) ?? string.Empty;
+ var extension = Path.GetExtension(path);
return _options.VideoFileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase);
}
@@ -136,7 +136,7 @@ namespace Emby.Naming.Video
/// <returns>True if is video file stub.</returns>
public bool IsStubFile(string path)
{
- var extension = Path.GetExtension(path) ?? string.Empty;
+ var extension = Path.GetExtension(path);
return _options.StubFileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase);
}