diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-04-08 12:45:30 -0400 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2013-04-08 12:45:30 -0400 |
| commit | cfe2c8f1b16d11a65e44973be2e605882de1e4d1 (patch) | |
| tree | 267671f10a6d6efea10a5f4c669ff21ad790beaa | |
| parent | 50c64e1ba1b2c4a879574225f64b3287d566ee1f (diff) | |
Only grab dvd files from the same title
| -rw-r--r-- | MediaBrowser.Controller/Providers/MediaInfo/FFProbeVideoInfoProvider.cs | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/MediaBrowser.Controller/Providers/MediaInfo/FFProbeVideoInfoProvider.cs b/MediaBrowser.Controller/Providers/MediaInfo/FFProbeVideoInfoProvider.cs index 74c641374..2fc140f2e 100644 --- a/MediaBrowser.Controller/Providers/MediaInfo/FFProbeVideoInfoProvider.cs +++ b/MediaBrowser.Controller/Providers/MediaInfo/FFProbeVideoInfoProvider.cs @@ -166,7 +166,28 @@ namespace MediaBrowser.Controller.Providers.MediaInfo // Try to eliminate menus and intros by skipping all files at the front of the list that are less than the minimum size // Once we reach a file that is at least the minimum, return all subsequent ones - video.PlayableStreamFileNames = Directory.EnumerateFiles(root, "*.vob", SearchOption.AllDirectories).SkipWhile(f => new FileInfo(f).Length < minPlayableSize).Select(Path.GetFileName).ToList(); + var files = Directory.EnumerateFiles(root, "*.vob", SearchOption.AllDirectories).SkipWhile(f => new FileInfo(f).Length < minPlayableSize).ToList(); + + // Assuming they're named "vts_05_01", take all files whose second part matches that of the first file + if (files.Count > 0) + { + var parts = Path.GetFileNameWithoutExtension(files[0]).Split('_'); + + if (parts.Length == 3) + { + var title = parts[1]; + + files = files.TakeWhile(f => + { + var fileParts = Path.GetFileNameWithoutExtension(f).Split('_'); + + return fileParts.Length == 3 && string.Equals(title, fileParts[1], StringComparison.OrdinalIgnoreCase); + + }).ToList(); + } + } + + video.PlayableStreamFileNames = files.Select(Path.GetFileName).ToList(); } /// <summary> |
