improve dvd vob file scan

pull/702/head
Luke Pulverenti 11 years ago
parent 3b4491b0b6
commit 18a9720857

@ -145,7 +145,18 @@ namespace MediaBrowser.Providers.MediaInfo
item.RunTimeTicks = dvd.Titles.Select(GetRuntime).Max();
PopulateDvdStreamFiles(item, mount);
var primaryTitle = dvd.Titles.OrderByDescending(GetRuntime).FirstOrDefault();
uint? titleNumber = null;
if (primaryTitle != null)
{
titleNumber = primaryTitle.TitleNumber;
}
item.PlayableStreamFileNames = GetPrimaryPlaylistVobFiles(item, mount, titleNumber)
.Select(Path.GetFileName)
.ToList();
}
private long GetRuntime(Title title)
@ -237,12 +248,7 @@ namespace MediaBrowser.Providers.MediaInfo
return null;
}
/// <summary>
/// Finds vob files and populates the dvd stream file properties
/// </summary>
/// <param name="video">The video.</param>
/// <param name="isoMount">The iso mount.</param>
private void PopulateDvdStreamFiles(Video video, IIsoMount isoMount)
private IEnumerable<string> GetPrimaryPlaylistVobFiles(Video video, IIsoMount isoMount, uint? titleNumber)
{
// min size 300 mb
const long minPlayableSize = 314572800;
@ -259,7 +265,20 @@ namespace MediaBrowser.Providers.MediaInfo
if (allVobs.Count == 0)
{
Logger.Error("No vobs found in dvd structure.");
return;
return new List<string>();
}
if (titleNumber.HasValue)
{
var prefix = string.Format("VTS_0{0}_", titleNumber.Value.ToString(UsCulture));
var vobs = allVobs.Where(i => Path.GetFileName(i).StartsWith(prefix, StringComparison.OrdinalIgnoreCase)).ToList();
if (vobs.Count > 0)
{
return vobs;
}
Logger.Debug("Could not determine vob file list for {0} using DvdLib. Will scan using file sizes.", video.Path);
}
var files = allVobs
@ -299,7 +318,7 @@ namespace MediaBrowser.Providers.MediaInfo
}
}
video.PlayableStreamFileNames = files.Select(Path.GetFileName).ToList();
return files;
}
/// <summary>

Loading…
Cancel
Save