Apply review suggestions
This commit is contained in:
parent
979964ef4b
commit
2403a0a367
|
@ -325,7 +325,7 @@ public class TranscodingJobHelper : IDisposable
|
||||||
await DeletePartialStreamFiles(job.Path!, job.Type, 0, 1500).ConfigureAwait(false);
|
await DeletePartialStreamFiles(job.Path!, job.Type, 0, 1500).ConfigureAwait(false);
|
||||||
if (job.MediaSource?.VideoType == VideoType.Dvd || job.MediaSource?.VideoType == VideoType.BluRay)
|
if (job.MediaSource?.VideoType == VideoType.Dvd || job.MediaSource?.VideoType == VideoType.BluRay)
|
||||||
{
|
{
|
||||||
var path = Path.Join(job.Path, "/" + job.MediaSource.Id + ".concat");
|
var path = Path.Join(job.Path, job.MediaSource.Id + ".concat");
|
||||||
File.Delete(path);
|
File.Delete(path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -943,7 +943,7 @@ namespace MediaBrowser.Controller.MediaEncoding
|
||||||
|
|
||||||
if (state.MediaSource.VideoType == VideoType.Dvd || state.MediaSource.VideoType == VideoType.BluRay)
|
if (state.MediaSource.VideoType == VideoType.Dvd || state.MediaSource.VideoType == VideoType.BluRay)
|
||||||
{
|
{
|
||||||
var tmpConcatPath = Path.Join(options.TranscodingTempPath, "/" + state.MediaSource.Id + ".concat");
|
var tmpConcatPath = Path.Join(options.TranscodingTempPath, state.MediaSource.Id + ".concat");
|
||||||
_mediaEncoder.GenerateConcatConfig(state.MediaSource, tmpConcatPath);
|
_mediaEncoder.GenerateConcatConfig(state.MediaSource, tmpConcatPath);
|
||||||
arg.Append(" -f concat -safe 0 ")
|
arg.Append(" -f concat -safe 0 ")
|
||||||
.Append(" -i ")
|
.Append(" -i ")
|
||||||
|
|
|
@ -11,6 +11,7 @@ using System.Text.Json;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Jellyfin.Extensions;
|
||||||
using Jellyfin.Extensions.Json;
|
using Jellyfin.Extensions.Json;
|
||||||
using Jellyfin.Extensions.Json.Converters;
|
using Jellyfin.Extensions.Json.Converters;
|
||||||
using MediaBrowser.Common;
|
using MediaBrowser.Common;
|
||||||
|
@ -896,7 +897,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
// Check for multiple big titles (> 900 MB)
|
// Check for multiple big titles (> 900 MB)
|
||||||
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).Split('_')[1])
|
.Select(vob => _fileSystem.GetFileNameWithoutExtension(vob).AsSpan().RightPart('_').ToString())
|
||||||
.GroupBy(x => x)
|
.GroupBy(x => x)
|
||||||
.Select(y => y.First())
|
.Select(y => y.First())
|
||||||
.ToList();
|
.ToList();
|
||||||
|
@ -904,12 +905,12 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
// 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.FirstOrDefault() == null)
|
||||||
{
|
{
|
||||||
titles.Add(_fileSystem.GetFileNameWithoutExtension(allVobs[0]).Split('_')[1]);
|
titles.Add(_fileSystem.GetFileNameWithoutExtension(allVobs[0]).AsSpan().RightPart('_').ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Aggregate all VOBs of the titles
|
// Aggregate all VOBs of the titles
|
||||||
return allVobs
|
return allVobs
|
||||||
.Where(vob => titles.Contains(_fileSystem.GetFileNameWithoutExtension(vob).Split('_')[1]))
|
.Where(vob => titles.Contains(_fileSystem.GetFileNameWithoutExtension(vob).AsSpan().RightPart('_').ToString()))
|
||||||
.Select(i => i.FullName)
|
.Select(i => i.FullName)
|
||||||
.ToList();
|
.ToList();
|
||||||
}
|
}
|
||||||
|
@ -917,7 +918,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
public IEnumerable<string> GetPrimaryPlaylistM2TsFiles(string path, uint? titleNumber)
|
public IEnumerable<string> GetPrimaryPlaylistM2TsFiles(string path, uint? titleNumber)
|
||||||
{
|
{
|
||||||
var validPlaybackFiles = _blurayExaminer.GetDiscInfo(path).Files;
|
var validPlaybackFiles = _blurayExaminer.GetDiscInfo(path).Files;
|
||||||
var directoryFiles = _fileSystem.GetFiles(path + "/BDMV/STREAM/");
|
var directoryFiles = _fileSystem.GetFiles(Path.Join(path, "BDMV", "STREAM"));
|
||||||
|
|
||||||
return directoryFiles
|
return directoryFiles
|
||||||
.Where(f => validPlaybackFiles.Contains(f.Name, StringComparer.OrdinalIgnoreCase))
|
.Where(f => validPlaybackFiles.Contains(f.Name, StringComparer.OrdinalIgnoreCase))
|
||||||
|
@ -941,7 +942,6 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
|
|
||||||
foreach (var path in files)
|
foreach (var path in files)
|
||||||
{
|
{
|
||||||
var fileinfo = _fileSystem.GetFileInfo(path);
|
|
||||||
var mediaInfoResult = GetMediaInfo(
|
var mediaInfoResult = GetMediaInfo(
|
||||||
new MediaInfoRequest
|
new MediaInfoRequest
|
||||||
{
|
{
|
||||||
|
@ -961,7 +961,7 @@ namespace MediaBrowser.MediaEncoding.Encoder
|
||||||
lines.Add("duration " + duration);
|
lines.Add("duration " + duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
File.WriteAllLinesAsync(concatFilePath, lines, CancellationToken.None).GetAwaiter().GetResult();
|
File.WriteAllLines(concatFilePath, lines);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool CanExtractSubtitles(string codec)
|
public bool CanExtractSubtitles(string codec)
|
||||||
|
|
|
@ -639,7 +639,6 @@ namespace MediaBrowser.Model.Dlna
|
||||||
if (item.VideoType == VideoType.Dvd || item.VideoType == VideoType.BluRay)
|
if (item.VideoType == VideoType.Dvd || item.VideoType == VideoType.BluRay)
|
||||||
{
|
{
|
||||||
isEligibleForDirectPlay = false;
|
isEligibleForDirectPlay = false;
|
||||||
isEligibleForDirectStream = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bitrateLimitExceeded)
|
if (bitrateLimitExceeded)
|
||||||
|
|
|
@ -328,9 +328,12 @@ namespace MediaBrowser.Providers.MediaInfo
|
||||||
{
|
{
|
||||||
var video = (Video)item;
|
var video = (Video)item;
|
||||||
|
|
||||||
// Use BD Info if it has multiple m2ts. Otherwise, treat it like a video file and rely more on ffprobe output
|
if (blurayInfo.Files.Length <= 1)
|
||||||
if (blurayInfo.Files.Length > 1)
|
|
||||||
{
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use BD Info if it has multiple m2ts. Otherwise, treat it like a video file and rely more on ffprobe output
|
||||||
int? currentHeight = null;
|
int? currentHeight = null;
|
||||||
int? currentWidth = null;
|
int? currentWidth = null;
|
||||||
int? currentBitRate = null;
|
int? currentBitRate = null;
|
||||||
|
@ -377,7 +380,6 @@ namespace MediaBrowser.Providers.MediaInfo
|
||||||
videoStream.Height = IsEmpty(videoStream.Height) ? currentHeight : videoStream.Height;
|
videoStream.Height = IsEmpty(videoStream.Height) ? currentHeight : videoStream.Height;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private bool IsEmpty(int? num)
|
private bool IsEmpty(int? num)
|
||||||
{
|
{
|
||||||
|
@ -391,10 +393,7 @@ namespace MediaBrowser.Providers.MediaInfo
|
||||||
/// <returns>VideoStream.</returns>
|
/// <returns>VideoStream.</returns>
|
||||||
private BlurayDiscInfo GetBDInfo(string path)
|
private BlurayDiscInfo GetBDInfo(string path)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(path))
|
ArgumentException.ThrowIfNullOrEmpty(path);
|
||||||
{
|
|
||||||
throw new ArgumentNullException(nameof(path));
|
|
||||||
}
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user