refactor(bamboo, uakino, uatut, uaflix): consolidate template output

This commit is contained in:
baliasnyifeliks 2026-02-02 16:43:47 +02:00
parent 708d708f2a
commit 92948d66cb
4 changed files with 12 additions and 8 deletions

View File

@ -94,10 +94,11 @@ namespace Bamboo.Controllers
index++;
}
episode_tpl.Append(voice_tpl);
if (rjson)
return Content(episode_tpl.ToJson(voice_tpl), "application/json; charset=utf-8");
return Content(episode_tpl.ToJson(), "application/json; charset=utf-8");
return Content(voice_tpl.ToHtml() + episode_tpl.ToHtml(), "text/html; charset=utf-8");
return Content(episode_tpl.ToHtml(), "text/html; charset=utf-8");
}
else
{

View File

@ -94,10 +94,11 @@ namespace UAKino.Controllers
index++;
}
episode_tpl.Append(voice_tpl);
if (rjson)
return Content(episode_tpl.ToJson(voice_tpl), "application/json; charset=utf-8");
return Content(episode_tpl.ToJson(), "application/json; charset=utf-8");
return Content(voice_tpl.ToHtml() + episode_tpl.ToHtml(), "text/html; charset=utf-8");
return Content(episode_tpl.ToHtml(), "text/html; charset=utf-8");
}
else
{

View File

@ -204,10 +204,11 @@ namespace UaTUT
OnLog($"UaTUT: generated {voiceCount} voices, {episodeCount} episodes");
episode_tpl.Append(voice_tpl);
if (rjson)
return Content(episode_tpl.ToJson(voice_tpl), "application/json; charset=utf-8");
return Content(episode_tpl.ToJson(), "application/json; charset=utf-8");
return Content(voice_tpl.ToHtml() + episode_tpl.ToHtml(), "text/html; charset=utf-8");
return Content(episode_tpl.ToHtml(), "text/html; charset=utf-8");
}
}

View File

@ -306,15 +306,16 @@ namespace Uaflix.Controllers
OnLog($"Created EpisodeTpl with {episodes.Count} episodes");
// Повертаємо VoiceTpl + EpisodeTpl разом
episode_tpl.Append(voice_tpl);
if (rjson)
{
OnLog($"=== RETURN: episode template with voices JSON ({episodes.Count} episodes) ===");
return Content(episode_tpl.ToJson(voice_tpl), "application/json; charset=utf-8");
return Content(episode_tpl.ToJson(), "application/json; charset=utf-8");
}
else
{
OnLog($"=== RETURN: voice + episode template HTML ({episodes.Count} episodes) ===");
return Content(voice_tpl.ToHtml() + episode_tpl.ToHtml(), "text/html; charset=utf-8");
return Content(episode_tpl.ToHtml(), "text/html; charset=utf-8");
}
}