Subtitle fix for track type

This commit is contained in:
Zoe Roux 2020-06-27 16:35:47 +02:00
parent 9d6efebcf2
commit c2cad382ba

View File

@ -5,6 +5,7 @@ using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Kyoo.Controllers;
using Kyoo.Models.Watch;
using Microsoft.AspNetCore.Authorization;
namespace Kyoo.Api
@ -22,6 +23,8 @@ namespace Kyoo.Api
// _transcoder = transcoder;
}
//TODO Create a real route for movie's subtitles.
[HttpGet("{showSlug}-s{seasonNumber:int}e{episodeNumber:int}.{identifier}.{extension?}")]
[Authorize(Policy="Play")]
public async Task<IActionResult> GetSubtitle(string showSlug,
@ -36,7 +39,7 @@ namespace Kyoo.Api
if (languageTag != null)
subtitle = (await _libraryManager.GetEpisode(showSlug, seasonNumber, episodeNumber))?.Tracks
.FirstOrDefault(x => x.Language == languageTag && x.IsForced == forced);
.FirstOrDefault(x => x.Type == StreamType.Subtitle && x.Language == languageTag && x.IsForced == forced);
if (subtitle == null)
{