From 6904edf68c359cff56b5e6cae9c1d05e2173cd18 Mon Sep 17 00:00:00 2001 From: Nils Fürniß Date: Wed, 9 Mar 2022 20:47:03 +0100 Subject: add extracting attachments from external subs --- Jellyfin.Api/Helpers/TranscodingJobHelper.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'Jellyfin.Api/Helpers/TranscodingJobHelper.cs') diff --git a/Jellyfin.Api/Helpers/TranscodingJobHelper.cs b/Jellyfin.Api/Helpers/TranscodingJobHelper.cs index 49a394868..3235da292 100644 --- a/Jellyfin.Api/Helpers/TranscodingJobHelper.cs +++ b/Jellyfin.Api/Helpers/TranscodingJobHelper.cs @@ -13,6 +13,7 @@ using Jellyfin.Api.Models.StreamingDtos; using Jellyfin.Data.Enums; using MediaBrowser.Common; using MediaBrowser.Common.Configuration; +using MediaBrowser.Common.Extensions; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.MediaEncoding; @@ -530,6 +531,15 @@ namespace Jellyfin.Api.Helpers { var attachmentPath = Path.Combine(_appPaths.CachePath, "attachments", state.MediaSource.Id); await _attachmentExtractor.ExtractAllAttachments(state.MediaPath, state.MediaSource, attachmentPath, CancellationToken.None).ConfigureAwait(false); + + if (state.SubtitleStream.IsExternal) + { + string subtitlePath = state.SubtitleStream.Path; + string subtitlePathArgument = string.Format(CultureInfo.InvariantCulture, "file:\"{0}\"", subtitlePath.Replace("\"", "\\\"", StringComparison.Ordinal)); + string subtitleId = subtitlePath.GetMD5().ToString("N", CultureInfo.InvariantCulture); + + await _attachmentExtractor.ExtractAllAttachmentsExternal(subtitlePathArgument, subtitleId, attachmentPath, CancellationToken.None).ConfigureAwait(false); + } } var process = new Process -- cgit v1.2.3