mirror of https://github.com/jellyfin/jellyfin.git
Code review: Count() -> Count and comments capitalization
This commit is contained in:
parent
9016fec892
commit
09e5c3ba69
|
@ -728,7 +728,7 @@ namespace Emby.Naming.Common
|
|||
|
||||
VideoVersionExpressions = new[]
|
||||
{
|
||||
// get filename before final space-dash-space
|
||||
// Get filename before final space-dash-space
|
||||
@"^(?<filename>.*?)(?:\s-\s(?!.*\s-\s)(.*))?$"
|
||||
};
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ namespace Emby.Naming.Video
|
|||
info.Year = info.Files[0].Year;
|
||||
if (info.Year is null)
|
||||
{
|
||||
// parse name for year info. Episodes don't get parsed up to this point for year info
|
||||
// Parse name for year info. Episodes don't get parsed up to this point for year info.
|
||||
var info2 = VideoResolver.Resolve(media.Path, media.IsDirectory, namingOptions, parseName);
|
||||
info.Year = info2?.Year;
|
||||
}
|
||||
|
@ -139,8 +139,8 @@ namespace Emby.Naming.Video
|
|||
continue;
|
||||
}
|
||||
|
||||
// don't merge stacked episodes
|
||||
if (video.Files.Count() == 1 && IsEligibleForMultiVersion(folderName, video.Files[0].Path, namingOptions, collectionType))
|
||||
// Don't merge stacked episodes
|
||||
if (video.Files.Count == 1 && IsEligibleForMultiVersion(folderName, video.Files[0].Path, namingOptions, collectionType))
|
||||
{
|
||||
mergeable.Add(video);
|
||||
}
|
||||
|
@ -164,12 +164,12 @@ namespace Emby.Naming.Video
|
|||
list.Add(OrganizeAlternateVersions(grouping.ToList(), grouping.Key.AsSpan(), primary));
|
||||
}
|
||||
}
|
||||
else if (mergeable.Count() > 0)
|
||||
else if (mergeable.Count > 0)
|
||||
{
|
||||
list.Add(OrganizeAlternateVersions(mergeable, folderName, primary));
|
||||
}
|
||||
|
||||
// add non mergeables back in
|
||||
// Add non mergeables back in
|
||||
list.AddRange(notMergeable);
|
||||
list.Sort((x, y) => string.Compare(x.Name, y.Name, StringComparison.Ordinal));
|
||||
|
||||
|
@ -185,7 +185,7 @@ namespace Emby.Naming.Video
|
|||
}
|
||||
|
||||
var alternateVersions = new List<VideoInfo>();
|
||||
if (grouping.Count() > 1)
|
||||
if (grouping.Count > 1)
|
||||
{
|
||||
// groups resolution based into one, and all other names
|
||||
var groups = grouping.GroupBy(x => ResolutionRegex().IsMatch(x.Files[0].FileNameWithoutExtension));
|
||||
|
@ -235,7 +235,7 @@ namespace Emby.Naming.Video
|
|||
|
||||
if (collectionType.Equals(CollectionType.TvShows, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// episodes are always eligible to be grouped
|
||||
// Episodes are always eligible to be grouped
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -264,13 +264,13 @@ namespace Emby.Naming.Video
|
|||
|
||||
private static string EpisodeGrouper(string testFilePath, NamingOptions namingOptions, ReadOnlySpan<char> collectionType)
|
||||
{
|
||||
// grouper for tv shows/episodes should be everything before space-dash-space
|
||||
// Grouper for tv shows/episodes should be everything before space-dash-space
|
||||
var resolver = new EpisodeResolver(namingOptions);
|
||||
EpisodeInfo? episodeInfo = resolver.Resolve(testFilePath, false);
|
||||
ReadOnlySpan<char> seriesName = episodeInfo!.SeriesName;
|
||||
|
||||
var filename = Path.GetFileNameWithoutExtension(testFilePath);
|
||||
// start with grouping by filename
|
||||
// Start with grouping by filename
|
||||
string g = filename;
|
||||
for (var i = 0; i < namingOptions.VideoVersionRegexes.Length; i++)
|
||||
{
|
||||
|
@ -282,13 +282,13 @@ namespace Emby.Naming.Video
|
|||
}
|
||||
|
||||
g = match.Groups["filename"].Value;
|
||||
// clean the filename
|
||||
// Clean the filename
|
||||
if (VideoResolver.TryCleanString(g, namingOptions, out string newName))
|
||||
{
|
||||
g = newName;
|
||||
}
|
||||
|
||||
// never group episodes under series name
|
||||
// Never group episodes under series name
|
||||
if (MemoryExtensions.Equals(g.AsSpan(), seriesName, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
g = filename;
|
||||
|
|
|
@ -1186,8 +1186,8 @@ namespace MediaBrowser.Controller.Entities
|
|||
|
||||
if (fileName == displayName)
|
||||
{
|
||||
// file does not start with parent folder name. This must be an episode in a mixed directory
|
||||
// get string after last dash - this is the version name
|
||||
// File does not start with parent folder name. This must be an episode in a mixed directory
|
||||
// Get string after last dash - this is the version name
|
||||
displayName = fileName.Substring(fileName.LastIndexOf('-') + 1).TrimStart(new char[] { ' ', '-' });
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,6 @@ namespace Jellyfin.Naming.Tests.Video
|
|||
[Fact]
|
||||
public void TestTVStackAndVersions()
|
||||
{
|
||||
// No stacking here because there is no part/disc/etc
|
||||
var files = new[]
|
||||
{
|
||||
@"/TV/Grey's Anatomy (2005)/Grey's Anatomy (2005) - s01e01 CD1.avi",
|
||||
|
@ -99,7 +98,6 @@ namespace Jellyfin.Naming.Tests.Video
|
|||
[Fact]
|
||||
public void TestTVStackAndVersionsNoFirstDash()
|
||||
{
|
||||
// No stacking here because there is no part/disc/etc
|
||||
var files = new[]
|
||||
{
|
||||
@"/TV/Grey's Anatomy (2005)/Grey's Anatomy (2005) s01e01 - pt1.avi",
|
||||
|
@ -129,7 +127,6 @@ namespace Jellyfin.Naming.Tests.Video
|
|||
[Fact]
|
||||
public void TestTVStack()
|
||||
{
|
||||
// No stacking here because there is no part/disc/etc
|
||||
var files = new[]
|
||||
{
|
||||
@"/TV/Doctor Who/Season 21/Doctor Who 21x11 - Resurrection of the Daleks - Part 1.mkv",
|
||||
|
|
Loading…
Reference in New Issue