diff options
| author | Claus Vium <clausvium@gmail.com> | 2019-02-19 17:34:43 +0100 |
|---|---|---|
| committer | Claus Vium <clausvium@gmail.com> | 2019-02-19 17:34:43 +0100 |
| commit | 518142723493cb95db37e06f917876464081229e (patch) | |
| tree | 647268715400ecc7550ddb100b285f44036c9677 | |
| parent | c79324154f3b3a8e7f005c9492e0de311fa4a0f1 (diff) | |
Revert "Merge pull request #924 from cvium/fix_movie_matching"
This reverts commit f274d024ceaacc23f0a30697aab8c0dfb05c402c, reversing
changes made to 4b4399fba6df3368ab04e78acd2dd08873e4f07b.
| -rw-r--r-- | Emby.Naming/Video/VideoListResolver.cs | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/Emby.Naming/Video/VideoListResolver.cs b/Emby.Naming/Video/VideoListResolver.cs index 20fa100fa..ef97b8739 100644 --- a/Emby.Naming/Video/VideoListResolver.cs +++ b/Emby.Naming/Video/VideoListResolver.cs @@ -175,16 +175,23 @@ namespace Emby.Naming.Video return videos; } - return videos.GroupBy(v => new {v.Name, v.Year}).Select(group => new VideoInfo + var folderName = Path.GetFileName(Path.GetDirectoryName(videos[0].Files[0].Path)); + + if (!string.IsNullOrEmpty(folderName) && folderName.Length > 1) { - // Because of the grouping, we can grab the information from the first movie and make it primary - // The remaining movie matches are 'alternate versions' - Name = group.First().Name, - Year = group.First().Year, - Files = group.First().Files, - AlternateVersions = group.Skip(1).Select(i => i.Files[0]).ToList(), - Extras = group.First().Extras.Concat(group.Skip(1).SelectMany(i => i.Extras)).ToList() - }); + var ordered = videos.OrderBy(i => i.Name); + + return ordered.GroupBy(v => new {v.Name, v.Year}).Select(group => new VideoInfo + { + Name = folderName, + Year = group.First().Year, + Files = group.First().Files, + AlternateVersions = group.Skip(1).Select(i => i.Files[0]).ToList(), + Extras = group.First().Extras.Concat(group.Skip(1).SelectMany(i => i.Extras)).ToList() + }); + } + + return videos; } private List<VideoFileInfo> GetExtras(IEnumerable<VideoFileInfo> remainingFiles, List<string> baseNames) |
