|
|
@ -871,7 +871,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
/// <inheritdoc />
|
|
|
|
public IEnumerable<string> GetPrimaryPlaylistVobFiles(string path, uint? titleNumber)
|
|
|
|
public IReadOnlyList<string> GetPrimaryPlaylistVobFiles(string path, uint? titleNumber)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Eliminate menus and intros by omitting VIDEO_TS.VOB and all subsequent title .vob files ending with _0.VOB
|
|
|
|
// Eliminate menus and intros by omitting VIDEO_TS.VOB and all subsequent title .vob files ending with _0.VOB
|
|
|
|
var allVobs = _fileSystem.GetFiles(path, true)
|
|
|
|
var allVobs = _fileSystem.GetFiles(path, true)
|
|
|
@ -888,7 +888,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|
|
|
|
|
|
|
|
|
|
|
if (vobs.Count > 0)
|
|
|
|
if (vobs.Count > 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return vobs.Select(i => i.FullName);
|
|
|
|
return vobs.Select(i => i.FullName).ToList();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
_logger.LogWarning("Could not determine .vob files for title {Title} of {Path}.", titleNumber, path);
|
|
|
|
_logger.LogWarning("Could not determine .vob files for title {Title} of {Path}.", titleNumber, path);
|
|
|
@ -898,12 +898,11 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|
|
|
var titles = allVobs
|
|
|
|
var titles = allVobs
|
|
|
|
.Where(vob => vob.Length >= 900 * 1024 * 1024)
|
|
|
|
.Where(vob => vob.Length >= 900 * 1024 * 1024)
|
|
|
|
.Select(vob => _fileSystem.GetFileNameWithoutExtension(vob).AsSpan().RightPart('_').ToString())
|
|
|
|
.Select(vob => _fileSystem.GetFileNameWithoutExtension(vob).AsSpan().RightPart('_').ToString())
|
|
|
|
.GroupBy(x => x)
|
|
|
|
.Distinct()
|
|
|
|
.Select(y => y.First())
|
|
|
|
|
|
|
|
.ToList();
|
|
|
|
.ToList();
|
|
|
|
|
|
|
|
|
|
|
|
// Fall back to first title if no big title is found
|
|
|
|
// Fall back to first title if no big title is found
|
|
|
|
if (titles.FirstOrDefault() == null)
|
|
|
|
if (titles.Count == 0)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
titles.Add(_fileSystem.GetFileNameWithoutExtension(allVobs[0]).AsSpan().RightPart('_').ToString());
|
|
|
|
titles.Add(_fileSystem.GetFileNameWithoutExtension(allVobs[0]).AsSpan().RightPart('_').ToString());
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -915,7 +914,8 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|
|
|
.ToList();
|
|
|
|
.ToList();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public IEnumerable<string> GetPrimaryPlaylistM2tsFiles(string path)
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
|
|
|
public IReadOnlyList<string> GetPrimaryPlaylistM2tsFiles(string path)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Get all playable .m2ts files
|
|
|
|
// Get all playable .m2ts files
|
|
|
|
var validPlaybackFiles = _blurayExaminer.GetDiscInfo(path).Files;
|
|
|
|
var validPlaybackFiles = _blurayExaminer.GetDiscInfo(path).Files;
|
|
|
@ -926,25 +926,32 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|
|
|
// Only return playable local .m2ts files
|
|
|
|
// Only return playable local .m2ts files
|
|
|
|
return directoryFiles
|
|
|
|
return directoryFiles
|
|
|
|
.Where(f => validPlaybackFiles.Contains(f.Name, StringComparer.OrdinalIgnoreCase))
|
|
|
|
.Where(f => validPlaybackFiles.Contains(f.Name, StringComparer.OrdinalIgnoreCase))
|
|
|
|
.Select(f => f.FullName);
|
|
|
|
.Select(f => f.FullName)
|
|
|
|
|
|
|
|
.ToList();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
public void GenerateConcatConfig(MediaSourceInfo source, string concatFilePath)
|
|
|
|
public void GenerateConcatConfig(MediaSourceInfo source, string concatFilePath)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
// Get all playable files
|
|
|
|
// Get all playable files
|
|
|
|
var files = new List<string>();
|
|
|
|
IReadOnlyList<string> files;
|
|
|
|
var videoType = source.VideoType;
|
|
|
|
var videoType = source.VideoType;
|
|
|
|
if (videoType == VideoType.Dvd)
|
|
|
|
if (videoType == VideoType.Dvd)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
files = GetPrimaryPlaylistVobFiles(source.Path, null).ToList();
|
|
|
|
files = GetPrimaryPlaylistVobFiles(source.Path, null);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (videoType == VideoType.BluRay)
|
|
|
|
else if (videoType == VideoType.BluRay)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
files = GetPrimaryPlaylistM2tsFiles(source.Path).ToList();
|
|
|
|
files = GetPrimaryPlaylistM2tsFiles(source.Path);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Generate concat configuration entries for each file
|
|
|
|
// Generate concat configuration entries for each file and write to file
|
|
|
|
var lines = new List<string>();
|
|
|
|
using (StreamWriter sw = new StreamWriter(concatFilePath))
|
|
|
|
|
|
|
|
{
|
|
|
|
foreach (var path in files)
|
|
|
|
foreach (var path in files)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var mediaInfoResult = GetMediaInfo(
|
|
|
|
var mediaInfoResult = GetMediaInfo(
|
|
|
@ -963,14 +970,12 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
|
|
|
var duration = TimeSpan.FromTicks(mediaInfoResult.RunTimeTicks.Value).TotalSeconds;
|
|
|
|
var duration = TimeSpan.FromTicks(mediaInfoResult.RunTimeTicks.Value).TotalSeconds;
|
|
|
|
|
|
|
|
|
|
|
|
// Add file path stanza to concat configuration
|
|
|
|
// Add file path stanza to concat configuration
|
|
|
|
lines.Add("file " + "'" + path + "'");
|
|
|
|
sw.WriteLine("file '{0}'", path);
|
|
|
|
|
|
|
|
|
|
|
|
// Add duration stanza to concat configuration
|
|
|
|
// Add duration stanza to concat configuration
|
|
|
|
lines.Add("duration " + duration);
|
|
|
|
sw.WriteLine("duration {0}", duration);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Write concat configuration
|
|
|
|
|
|
|
|
File.WriteAllLines(concatFilePath, lines);
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public bool CanExtractSubtitles(string codec)
|
|
|
|
public bool CanExtractSubtitles(string codec)
|
|
|
|