mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-07-09 03:04:20 -04:00
Solving a bug with the GetSubtitle method of the public api
This commit is contained in:
parent
2cfb285c22
commit
8bfb4cf2b2
@ -23,17 +23,13 @@ namespace Kyoo.Api
|
|||||||
[HttpGet("{showSlug}-s{seasonNumber:int}e{episodeNumber:int}.{identifier}.{extension?}")]
|
[HttpGet("{showSlug}-s{seasonNumber:int}e{episodeNumber:int}.{identifier}.{extension?}")]
|
||||||
public IActionResult GetSubtitle(string showSlug, int seasonNumber, int episodeNumber, string identifier, string extension)
|
public IActionResult GetSubtitle(string showSlug, int seasonNumber, int episodeNumber, string identifier, string extension)
|
||||||
{
|
{
|
||||||
|
string languageTag = identifier.Substring(0, 3);
|
||||||
bool forced = identifier.Length > 3 && identifier.Substring(4) == "forced";
|
bool forced = identifier.Length > 3 && identifier.Substring(4) == "forced";
|
||||||
Track subtitle;
|
Track subtitle = _libraryManager.GetSubtitle(showSlug, seasonNumber, episodeNumber, languageTag, forced);
|
||||||
|
|
||||||
if (identifier.Length >= 3 && identifier[3] == '-')
|
if (subtitle == null)
|
||||||
{
|
{
|
||||||
string languageTag = identifier.Substring(0, 3);
|
long.TryParse(identifier.Substring(0, identifier.IndexOf('-')), out long id);
|
||||||
subtitle = _libraryManager.GetSubtitle(showSlug, seasonNumber, episodeNumber, languageTag, forced);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
long.TryParse(identifier.Substring(0, 3), out long id);
|
|
||||||
subtitle = _libraryManager.GetSubtitleById(id);
|
subtitle = _libraryManager.GetSubtitleById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user