From f63578f6db1bf3d70eab1f772e12458a687306ad Mon Sep 17 00:00:00 2001 From: da3dsoul Date: Tue, 21 Nov 2023 08:51:19 -0500 Subject: [PATCH] Experiment with streaming option --- .../ShokoServiceImplementationStream.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Shoko.Server/API/v1/Implementations/ShokoServiceImplementationStream.cs b/Shoko.Server/API/v1/Implementations/ShokoServiceImplementationStream.cs index 24326a997..e57a9ee63 100644 --- a/Shoko.Server/API/v1/Implementations/ShokoServiceImplementationStream.cs +++ b/Shoko.Server/API/v1/Implementations/ShokoServiceImplementationStream.cs @@ -38,12 +38,13 @@ public class ShokoServiceImplementationStream : Controller, IShokoServerStream, public object StreamVideo(int videolocalid, int? userId, bool? autowatch, string fakename) { var r = ResolveVideoLocal(videolocalid, userId, autowatch); - if (r.Status != HttpStatusCode.OK && r.Status != HttpStatusCode.PartialContent) - { - return StatusCode((int)r.Status, r.StatusDescription); - } + if (r.Status != HttpStatusCode.OK && r.Status != HttpStatusCode.PartialContent) return StatusCode((int)r.Status, r.StatusDescription); + if (!string.IsNullOrEmpty(fakename)) return StreamFromIFile(r, autowatch); - return StreamFromIFile(r, autowatch); + var subs = r.VideoLocal.Media.TextStreams.Where(a => a.External).ToList(); + if (!subs.Any()) return StatusCode(404); + + return "" + string.Join(string.Empty, subs.Select(a => "")) + "
"; } [HttpGet("Filename/{base64filename}/{userId?}/{autowatch?}/{fakename?}")]