proxy external subtitle files (#1203)

This commit is contained in:
Jason Dove
2023-03-09 19:31:59 -06:00
committed by GitHub
parent bd2f0f6236
commit 35445e2b3d
7 changed files with 71 additions and 4 deletions
@@ -98,6 +98,15 @@ public class FFmpegLibraryProcessService : IFFmpegProcessService
preferredSubtitleLanguage,
subtitleMode);
foreach (Subtitle subtitle in maybeSubtitle)
{
if (subtitle.SubtitleKind == SubtitleKind.Sidecar)
{
// proxy to avoid dealing with escaping
subtitle.Path = $"http://localhost:{Settings.ListenPort}/media/subtitle/{subtitle.Id}";
}
}
Option<WatermarkOptions> watermarkOptions = disableWatermarks
? None
: await _ffmpegProcessService.GetWatermarkOptions(
@@ -194,9 +203,12 @@ public class FFmpegLibraryProcessService : IFFmpegProcessService
subtitle.Codec,
StreamKind.Video);
string path = subtitle.IsImage
? videoPath
: Path.Combine(FileSystemLayout.SubtitleCacheFolder, subtitle.Path);
string path = subtitle.IsImage switch
{
true => videoPath,
false when subtitle.SubtitleKind == SubtitleKind.Sidecar => subtitle.Path,
_ => Path.Combine(FileSystemLayout.SubtitleCacheFolder, subtitle.Path)
};
return new SubtitleInputFile(
path,