113 lines
4.2 KiB
Plaintext
113 lines
4.2 KiB
Plaintext
@page
|
|
@model InfoModel
|
|
@{
|
|
ViewData["Title"] = "Info";
|
|
}
|
|
@{
|
|
if (string.IsNullOrWhiteSpace(Request.Query["guid"])) {
|
|
Response.Redirect("/");
|
|
return;
|
|
}
|
|
|
|
c3stream.UpdateCookie(Request, Response, $"/Info?guid={Request.Query["guid"]}&");
|
|
|
|
ConferenceModel.ReadEventMetadata();
|
|
var talk = ConferenceModel.EventMetadata.FirstOrDefault(p => p.Guid == Request.Query["guid"]);
|
|
if (talk == null) {
|
|
Response.Redirect("/");
|
|
return;
|
|
}
|
|
|
|
var title = talk.Talk.Title;
|
|
var speakers = talk.Talk.Persons.Aggregate((s, s1) => $"{s}, {s1}");
|
|
var description = talk.Talk.Description;
|
|
if (string.IsNullOrEmpty(description)) {
|
|
description = "<missing description>";
|
|
}
|
|
|
|
var isWatched = talk.State.FirstOrDefault(q => q.Guid == Request.Cookies["bookmark"])?.State == "watched";
|
|
var isMarked = talk.State.FirstOrDefault(q => q.Guid == Request.Cookies["bookmark"])?.State == "marked";
|
|
var file = talk.Talk.Recordings.FirstOrDefault(p => System.IO.File.Exists(System.IO.Path.Combine(c3stream.CachePath, talk.Talk.ConferenceUrl.AbsoluteUri.Split("/").Last(), p.Filename)));
|
|
var eventName = talk.Talk.Tags[0].Replace("-", "-<br/>");
|
|
|
|
int tagFormat;
|
|
switch (talk.Talk.ConferenceUrl.AbsoluteUri.Split("/").Last()) {
|
|
case "36c3":
|
|
tagFormat = 2;
|
|
break;
|
|
case "35c3":
|
|
case "34c3":
|
|
tagFormat = 1;
|
|
break;
|
|
case "33c3":
|
|
tagFormat = 0;
|
|
break;
|
|
default:
|
|
Response.Redirect("/");
|
|
return;
|
|
}
|
|
|
|
var category = tagFormat switch {
|
|
0 => talk.Talk.Tags[0],
|
|
1 => talk.Talk.Tags[2],
|
|
2 => talk.Talk.Tags[3],
|
|
_ => ""
|
|
};
|
|
}
|
|
|
|
@if (isWatched) {
|
|
<h3 style="color: limegreen">@title - <i>@speakers</i></h3>
|
|
}
|
|
else if (isMarked) {
|
|
<h3 style="color: orangered">@title - <i>@speakers</i></h3>
|
|
}
|
|
else {
|
|
<h3>@title - <i>@speakers</i></h3>
|
|
}
|
|
|
|
<div class="btn-group" role="group" style="margin-bottom: 10px">
|
|
<a href="@talk.Talk.FrontendLink.AbsoluteUri" target="_blank" type="button" class="btn btn-primary w-100" data-toggle="tooltip" data-placement="right" title="Play">
|
|
<i class="fas fa-play-circle"></i>
|
|
</a>
|
|
@if (file != null) {
|
|
<a href="@(c3stream.CacheUrl + $"{talk.Talk.ConferenceUrl.AbsoluteUri.Split("/").Last()}/{file.Filename}")" target="_blank" type="button" class="btn btn-primary w-100" data-toggle="tooltip" data-placement="right" title="Mirror">
|
|
<i class="fas fa-cloud-download"></i>
|
|
</a>
|
|
}
|
|
else {
|
|
<a href="/" target="_blank" type="button" class="btn btn-primary disabled">
|
|
<i class="fas fa-cloud-download"></i>
|
|
</a>
|
|
}
|
|
@if (isWatched) {
|
|
<button onclick="SetState('@talk.Guid', 'unwatched')" class="btn btn-primary w-100" data-toggle="tooltip" data-placement="left" title="Mark unwatched">
|
|
<i class="fas fa-times"></i>
|
|
</button>
|
|
<button class="btn btn-primary disabled">
|
|
<i class="fas fa-clock"></i>
|
|
</button>
|
|
}
|
|
else if (isMarked) {
|
|
<button onclick="SetState('@talk.Guid', 'watched')" class="btn btn-primary w-100" data-toggle="tooltip" data-placement="left" title="Mark watched">
|
|
<i class="fas fa-check"></i>
|
|
</button>
|
|
<button onclick="SetState('@talk.Guid', 'unwatched')" class="btn btn-primary w-100" data-toggle="tooltip" data-placement="left" title="Remove from watch later">
|
|
<i class="fas fa-undo-alt"></i>
|
|
</button>
|
|
}
|
|
else {
|
|
<button onclick="SetState('@talk.Guid', 'watched')" class="btn btn-primary w-100" data-toggle="tooltip" data-placement="left" title="Mark watched">
|
|
<i class="fas fa-check"></i>
|
|
</button>
|
|
<button onclick="SetState('@talk.Guid', 'marked')" class="btn btn-primary w-100" data-toggle="tooltip" data-placement="left" title="Add to watch later">
|
|
<i class="fas fa-clock"></i>
|
|
</button>
|
|
}
|
|
</div>
|
|
|
|
<p style="text-align: justify">
|
|
@Html.Raw(description.Replace("\n", "<br/>").Replace("<p>", "").Replace("</p>", ""))
|
|
</p>
|
|
|
|
Share this talk:<br/>
|
|
<code onclick="copyToClipboard(this)">https://@Request.Host.Value/Info?guid=@Request.Query["guid"]</code> |