aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaus Vium <clausvium@gmail.com>2019-02-17 07:39:36 +0100
committerClaus Vium <clausvium@gmail.com>2019-02-17 07:39:36 +0100
commitc45b6aa53e8605fdf1d93c669890eeb09d30c268 (patch)
tree3eeae7b1277f44e4bd25795e215d565ee16321ec
parent4b4399fba6df3368ab04e78acd2dd08873e4f07b (diff)
Use the movie name instead of folder name
-rw-r--r--Emby.Naming/Video/VideoListResolver.cs25
1 files changed, 9 insertions, 16 deletions
diff --git a/Emby.Naming/Video/VideoListResolver.cs b/Emby.Naming/Video/VideoListResolver.cs
index ef97b8739..20fa100fa 100644
--- a/Emby.Naming/Video/VideoListResolver.cs
+++ b/Emby.Naming/Video/VideoListResolver.cs
@@ -175,23 +175,16 @@ namespace Emby.Naming.Video
return videos;
}
- var folderName = Path.GetFileName(Path.GetDirectoryName(videos[0].Files[0].Path));
-
- if (!string.IsNullOrEmpty(folderName) && folderName.Length > 1)
+ return videos.GroupBy(v => new {v.Name, v.Year}).Select(group => new VideoInfo
{
- 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;
+ // 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()
+ });
}
private List<VideoFileInfo> GetExtras(IEnumerable<VideoFileInfo> remainingFiles, List<string> baseNames)