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
@ -22,18 +22,14 @@ namespace Kyoo.Api
|
||||
|
||||
[HttpGet("{showSlug}-s{seasonNumber:int}e{episodeNumber:int}.{identifier}.{extension?}")]
|
||||
public IActionResult GetSubtitle(string showSlug, int seasonNumber, int episodeNumber, string identifier, string extension)
|
||||
{
|
||||
bool forced = identifier.Length > 3 && identifier.Substring(4) == "forced";
|
||||
Track subtitle;
|
||||
|
||||
if (identifier.Length >= 3 && identifier[3] == '-')
|
||||
{
|
||||
string languageTag = identifier.Substring(0, 3);
|
||||
subtitle = _libraryManager.GetSubtitle(showSlug, seasonNumber, episodeNumber, languageTag, forced);
|
||||
}
|
||||
else
|
||||
bool forced = identifier.Length > 3 && identifier.Substring(4) == "forced";
|
||||
Track subtitle = _libraryManager.GetSubtitle(showSlug, seasonNumber, episodeNumber, languageTag, forced);
|
||||
|
||||
if (subtitle == null)
|
||||
{
|
||||
long.TryParse(identifier.Substring(0, 3), out long id);
|
||||
long.TryParse(identifier.Substring(0, identifier.IndexOf('-')), out long id);
|
||||
subtitle = _libraryManager.GetSubtitleById(id);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user