diff options
| author | Claus Vium <clausvium@gmail.com> | 2019-02-19 17:10:11 +0100 |
|---|---|---|
| committer | Claus Vium <clausvium@gmail.com> | 2019-02-19 17:10:11 +0100 |
| commit | c79324154f3b3a8e7f005c9492e0de311fa4a0f1 (patch) | |
| tree | 3eeae7b1277f44e4bd25795e215d565ee16321ec | |
| parent | 77d4fec6eb75b9b26a24e0678c7a75d8decb2e29 (diff) | |
Revert "Merge pull request #933 from cvium/fix_movie_matching_again"
This reverts commit 77d4fec6eb75b9b26a24e0678c7a75d8decb2e29, reversing
changes made to f274d024ceaacc23f0a30697aab8c0dfb05c402c.
| -rw-r--r-- | Emby.Naming/Video/VideoListResolver.cs | 50 |
1 files changed, 1 insertions, 49 deletions
diff --git a/Emby.Naming/Video/VideoListResolver.cs b/Emby.Naming/Video/VideoListResolver.cs index 3348ec2fb..20fa100fa 100644 --- a/Emby.Naming/Video/VideoListResolver.cs +++ b/Emby.Naming/Video/VideoListResolver.cs @@ -175,55 +175,7 @@ namespace Emby.Naming.Video return videos; } - var folderName = Path.GetFileName(Path.GetDirectoryName(videos[0].Files[0].Path)); - if (!string.IsNullOrEmpty(folderName)) - { - var videosMatchingFolder = new List<VideoInfo>(); - foreach (VideoInfo video in videos) - { - // Only interested in single files - if (video.Files.Count != 1) - { - continue; - } - - if (string.Equals(folderName, video.Name, StringComparison.OrdinalIgnoreCase)) - { - videosMatchingFolder.Add(video); - } - // Eg. My Movie == My Movie - Some Other Info, TODO doesn't seem like a robust test - else if (video.Name.StartsWith(folderName, StringComparison.OrdinalIgnoreCase) && - video.Name.Substring(folderName.Length).TrimStart().StartsWith("-")) - { - videosMatchingFolder.Add(video); - } - } - - // It is assumed that any non-matching files are random samples, trailers, extras etc. - // So if there's at least one video file matching the folder name, skip the rest. - if (videosMatchingFolder.Count > 0) - { - var primary = videosMatchingFolder[0]; - var remainingVideos = videosMatchingFolder.Skip(1); - var videoInfo = new VideoInfo - { - Name = folderName, - Year = primary.Year, - Files = primary.Files, - AlternateVersions = new List<VideoFileInfo>(), - Extras = primary.Extras - }; - foreach (VideoInfo video in remainingVideos) - { - videoInfo.AlternateVersions.Add(video.Files.First()); - videoInfo.Extras.AddRange(video.Extras); - } - - return new[] { videoInfo }; - } - } - - return videos.GroupBy(v => new { v.Name, v.Year }).Select(group => new VideoInfo + return videos.GroupBy(v => new {v.Name, v.Year}).Select(group => new VideoInfo { // Because of the grouping, we can grab the information from the first movie and make it primary // The remaining movie matches are 'alternate versions' |
