Info page updates

This commit is contained in:
Laura Hausmann 2020-01-05 11:24:50 +01:00
parent 640b22a496
commit 6b8b436ee2
2 changed files with 19 additions and 3 deletions

View file

@ -23,7 +23,7 @@
}
var title = talk.Title;
var speakers = talk.Persons.Aggregate((s, s1) => $"{s}, {s1}");
var speakers = talk.Persons.Any() ? talk.Persons.Aggregate((s, s1) => $"{s}, {s1}") : "<no speakers>";
var description = talk.Description;
if (string.IsNullOrEmpty(description)) {
description = "&lt;missing description&gt;";
@ -34,7 +34,8 @@
var file = $"{talk.Slug}.mp4";
var conference = c3stream.GetConferenceByEventGuid(talk.Guid);
var eventName = talk.Tags.Count > 1 ? conference.Acronym : talk.Tags[0].Replace("-", "-<br/>");
var eventName = talk.Tags.Count <= 1 ? conference.Acronym : talk.Tags[0];
var logoPath = System.IO.Path.Combine(c3stream.CachePath, conference.Acronym, "logo.png");
var category = talk.Tags.Count switch {
0 => "<no category>",
@ -47,6 +48,14 @@
};
}
@if (System.IO.File.Exists(logoPath)) {
<img src="@(c3stream.CacheUrl + $"{conference.Acronym}/logo.png")" alt="Conference logo" style="height: 100px; padding-bottom: 5px; padding-left: 2px;"/>
}
else {
<img src="@conference.LogoUri" alt="Conference logo" style="height: 100px; padding-bottom: 5px; padding-left: 2px;"/>
}
<br/>
@if (isWatched) {
<h3 style="color: #95cb7a">@title - <i>@speakers</i></h3>
}
@ -57,6 +66,7 @@ else {
<h3>@title - <i>@speakers</i></h3>
}
<h5>@eventName - @category - @talk.Date?.Date.ToShortDateString()</h5>
<div class="btn-group" role="group" style="margin-bottom: 10px">
<a href="@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>

View file

@ -38,7 +38,11 @@ namespace c3stream {
UpdateConference(conference);
if (args.Length != 0) {
if (Conferences.All(p => p.Acronym != args[0]))
if (args[0] == "logo")
foreach (var conference in Conferences) {
Console.WriteLine($"wget {conference.LogoUri} -O {Path.Combine(CachePath, conference.Acronym, "logo.png")}");
}
else if (Conferences.All(p => p.Acronym != args[0]))
Console.WriteLine("No matching conference found.");
else
foreach (var talk in Conferences.First(p => p.Acronym == args[0]).Talks)
@ -68,6 +72,7 @@ namespace c3stream {
var parsed = Conference.FromJson(json);
lock (Lock) {
conference.Talks.Clear();
conference.LogoUri = parsed.LogoUrl.AbsoluteUri;
conference.Talks.AddRange(parsed.Events);
}
}
@ -104,6 +109,7 @@ namespace c3stream {
public class ConferenceObject {
public string Acronym;
public bool Ongoing;
public string LogoUri;
public List<Event> Talks = new List<Event>();
public ConferenceObject(string acronym, bool ongoing = false) {