From c8177bc83ff587d5dd3518061d526ea227a6175f Mon Sep 17 00:00:00 2001 From: Laura Hausmann Date: Sun, 6 Mar 2022 18:07:53 +0100 Subject: [PATCH] Make logoPath separate from CachePath --- Pages/Info.cshtml | 8 ++------ c3stream.cs | 6 ++++-- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/Pages/Info.cshtml b/Pages/Info.cshtml index 6259db6..0fb86f6 100644 --- a/Pages/Info.cshtml +++ b/Pages/Info.cshtml @@ -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 => "", @@ -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); } -Conference logo +Conference logo @if (isWatched) {

@title - @speakers

diff --git a/c3stream.cs b/c3stream.cs index 598c146..65c6013 100644 --- a/c3stream.cs +++ b/c3stream.cs @@ -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; } } -} \ No newline at end of file +}