Make logoPath separate from CachePath
This commit is contained in:
parent
825cd0985a
commit
c8177bc83f
|
@ -40,7 +40,7 @@
|
|||
var conference = c3stream.GetConferenceByEventGuid(talk.Guid);
|
||||
|
||||
var eventName = talk.Tags.Count <= 1 ? conference.Acronym : talk.Tags[0];
|
||||
var logoPath = System.IO.Path.Combine(c3stream.CachePath, conference.Acronym, "logo.png");
|
||||
var logoPath = System.IO.Path.Combine(c3stream.LogoPath, conference.Acronym + ".png");
|
||||
|
||||
var category = talk.Tags.Count switch {
|
||||
0 => "<no category>",
|
||||
|
@ -55,17 +55,13 @@
|
|||
}
|
||||
|
||||
@if (!System.IO.File.Exists(logoPath)) {
|
||||
if (!Directory.Exists(System.IO.Path.Combine(c3stream.CachePath, conference.Acronym))) {
|
||||
Directory.CreateDirectory(System.IO.Path.Combine(c3stream.CachePath, conference.Acronym));
|
||||
}
|
||||
|
||||
using var httpClient = new HttpClient();
|
||||
await using var stream = httpClient.GetStreamAsync(conference.LogoUri).Result;
|
||||
await using var fileStream = new FileStream(logoPath, FileMode.CreateNew);
|
||||
await stream.CopyToAsync(fileStream);
|
||||
}
|
||||
|
||||
<img src="@(c3stream.CacheUrl + $"{conference.Acronym}/logo.png")" alt="Conference logo" style="max-height: 110px; float: right;"/>
|
||||
<img src="@(c3stream.LogoUrl + $"{conference.Acronym}.png")" alt="Conference logo" style="max-height: 110px; float: right;"/>
|
||||
|
||||
@if (isWatched) {
|
||||
<h3 style="color: #95cb7a">@title - <i>@speakers</i></h3>
|
||||
|
|
|
@ -14,6 +14,8 @@ namespace c3stream;
|
|||
public static class c3stream {
|
||||
public const string DataPath = "data";
|
||||
public const string DbFile = "c3stream.sqlite";
|
||||
public const string LogoPath = "/mnt/nvme-data/c3stream-logos/";
|
||||
public const string LogoUrl = "https://mirror.c3stream.de/logos/";
|
||||
public const string CachePath = "/mnt/storage/archive/Video/congress/";
|
||||
public const string CacheUrl = "https://mirror.c3stream.de/";
|
||||
public static object Lock = new();
|
||||
|
@ -48,7 +50,7 @@ public static class c3stream {
|
|||
if (args.Length != 0) {
|
||||
if (args[0] == "logo")
|
||||
foreach (var conference in Conferences)
|
||||
Console.WriteLine($"wget {conference.LogoUri} -O {Path.Combine(CachePath, conference.Acronym, "logo.png")}");
|
||||
Console.WriteLine($"wget {conference.LogoUri} -O {Path.Combine(LogoPath, conference.Acronym + ".png")}");
|
||||
else if (Conferences.All(p => p.Acronym != args[0]))
|
||||
Console.WriteLine("No matching conference found.");
|
||||
else
|
||||
|
@ -134,4 +136,4 @@ public static class c3stream {
|
|||
Ongoing = ongoing;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue