Use concat config for BDMV/DVD folder attachment extraction

This commit is contained in:
Shadowghost 2024-02-10 16:52:21 +01:00
parent 20f05f8103
commit f34c56282d

View File

@ -405,7 +405,7 @@ public sealed class TranscodeManager : ITranscodeManager, IDisposable
var user = userId.IsEmpty() ? null : _userManager.GetUserById(userId); var user = userId.IsEmpty() ? null : _userManager.GetUserById(userId);
if (user is not null && !user.HasPermission(PermissionKind.EnableVideoPlaybackTranscoding)) if (user is not null && !user.HasPermission(PermissionKind.EnableVideoPlaybackTranscoding))
{ {
this.OnTranscodeFailedToStart(outputPath, transcodingJobType, state); OnTranscodeFailedToStart(outputPath, transcodingJobType, state);
throw new ArgumentException("User does not have access to video transcoding."); throw new ArgumentException("User does not have access to video transcoding.");
} }
@ -417,7 +417,12 @@ public sealed class TranscodeManager : ITranscodeManager, IDisposable
if (state.SubtitleStream is not null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode) if (state.SubtitleStream is not null && state.SubtitleDeliveryMethod == SubtitleDeliveryMethod.Encode)
{ {
var attachmentPath = Path.Combine(_appPaths.CachePath, "attachments", state.MediaSource.Id); var attachmentPath = Path.Combine(_appPaths.CachePath, "attachments", state.MediaSource.Id);
if (state.VideoType != VideoType.Dvd) if (state.MediaSource.VideoType == VideoType.Dvd || state.MediaSource.VideoType == VideoType.BluRay)
{
var concatPath = Path.Join(_serverConfigurationManager.GetTranscodePath(), state.MediaSource.Id + ".concat");
await _attachmentExtractor.ExtractAllAttachments(concatPath, state.MediaSource, attachmentPath, cancellationTokenSource.Token).ConfigureAwait(false);
}
else
{ {
await _attachmentExtractor.ExtractAllAttachments(state.MediaPath, state.MediaSource, attachmentPath, cancellationTokenSource.Token).ConfigureAwait(false); await _attachmentExtractor.ExtractAllAttachments(state.MediaPath, state.MediaSource, attachmentPath, cancellationTokenSource.Token).ConfigureAwait(false);
} }
@ -432,7 +437,7 @@ public sealed class TranscodeManager : ITranscodeManager, IDisposable
} }
} }
var process = new Process using var process = new Process
{ {
StartInfo = new ProcessStartInfo StartInfo = new ProcessStartInfo
{ {
@ -452,7 +457,7 @@ public sealed class TranscodeManager : ITranscodeManager, IDisposable
EnableRaisingEvents = true EnableRaisingEvents = true
}; };
var transcodingJob = this.OnTranscodeBeginning( var transcodingJob = OnTranscodeBeginning(
outputPath, outputPath,
state.Request.PlaySessionId, state.Request.PlaySessionId,
state.MediaSource.LiveStreamId, state.MediaSource.LiveStreamId,
@ -507,7 +512,7 @@ public sealed class TranscodeManager : ITranscodeManager, IDisposable
catch (Exception ex) catch (Exception ex)
{ {
_logger.LogError(ex, "Error starting FFmpeg"); _logger.LogError(ex, "Error starting FFmpeg");
this.OnTranscodeFailedToStart(outputPath, transcodingJobType, state); OnTranscodeFailedToStart(outputPath, transcodingJobType, state);
throw; throw;
} }