From adab6e21e577a5c8307f6599436e2996c3095399 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 5 Jun 2013 10:58:22 -0400 Subject: [PATCH] update subtitle resolution --- .../MediaInfo/FFProbeVideoInfoProvider.cs | 34 ++++++++----------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/MediaBrowser.Controller/Providers/MediaInfo/FFProbeVideoInfoProvider.cs b/MediaBrowser.Controller/Providers/MediaInfo/FFProbeVideoInfoProvider.cs index 7ea399fe68..c95f0771fa 100644 --- a/MediaBrowser.Controller/Providers/MediaInfo/FFProbeVideoInfoProvider.cs +++ b/MediaBrowser.Controller/Providers/MediaInfo/FFProbeVideoInfoProvider.cs @@ -249,31 +249,25 @@ namespace MediaBrowser.Controller.Providers.MediaInfo var startIndex = video.MediaStreams == null ? 0 : video.MediaStreams.Count; var streams = new List(); - foreach (var file in fileSystemChildren.Where(f => !f.Attributes.HasFlag(FileAttributes.Directory))) + foreach (var file in fileSystemChildren + .Where(f => !f.Attributes.HasFlag(FileAttributes.Directory) && string.Equals(Path.GetExtension(f.FullName), ".srt", StringComparison.OrdinalIgnoreCase))) { var fullName = file.FullName; - var extension = Path.GetExtension(fullName); - if (string.Equals(extension, ".srt", StringComparison.OrdinalIgnoreCase)) + // The subtitle filename must match video filename + if (!string.Equals(Path.GetFileNameWithoutExtension(video.Path), Path.GetFileNameWithoutExtension(fullName))) { - if (video.VideoType == VideoType.VideoFile) - { - // For video files the subtitle filename must match video filename - if (!string.Equals(Path.GetFileNameWithoutExtension(video.Path), Path.GetFileNameWithoutExtension(fullName))) - { - continue; - } - } - - streams.Add(new MediaStream - { - Index = startIndex++, - Type = MediaStreamType.Subtitle, - IsExternal = true, - Path = fullName, - Codec = "srt" - }); + continue; } + + streams.Add(new MediaStream + { + Index = startIndex++, + Type = MediaStreamType.Subtitle, + IsExternal = true, + Path = fullName, + Codec = "srt" + }); } if (video.MediaStreams == null)