Files
stream-cinema/CinemaWeb/Pages/MediaPage.cs
Roman Vaníček 0bcb6d571f
All checks were successful
continuous-integration/drone/push Build is passing
Rename to Cinema
2024-11-30 00:50:10 +01:00

39 lines
873 B
C#

using System;
using System.Web;
using CinemaLib.API;
using CinemaWeb.Layouts;
namespace CinemaWeb.Pages;
public class MediaPage : BasicLayout
{
private readonly string _id;
private readonly string _title;
public MediaPage(string id, string title)
{
this._id = id;
this._title = title;
}
protected override string Title => _title;
protected override async Task RenderContentAsync(HttpRequest req, TextWriter w)
{
w.WriteLine("<h1>" + HttpUtility.HtmlEncode(_title) + "</h1>");
w.WriteLine("<div>TODO</div>");
w.WriteLine("<h2>Zvolte kvalitu</h2>");
CinemaLib.API.Stream[]? res = await Metadata.StreamsAsync(_id, cancel: req.HttpContext.RequestAborted);
if (res == null || res.Length == 0)
{
w.WriteLine("<em>Nic nenalezeno</em>");
}
else
{
StreamsPage.RenderStreams(w, res, _title);
}
}
}