From e829f52acc519ae7c590f5a7e9cff2fa697eec59 Mon Sep 17 00:00:00 2001 From: rlauuzo <46294892+rlauuzo@users.noreply.github.com> Date: Sat, 21 Sep 2024 20:12:00 +0200 Subject: [PATCH] use correct library name (#301) Co-authored-by: rlauu <46294892+rlauu@users.noreply.github.com> --- .../Controllers/VisualizationController.cs | 12 +++++++++--- ConfusedPolarBear.Plugin.IntroSkipper/Plugin.cs | 6 ++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Controllers/VisualizationController.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Controllers/VisualizationController.cs index 2d037d9..e5658d4 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Controllers/VisualizationController.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Controllers/VisualizationController.cs @@ -302,8 +302,14 @@ public class VisualizationController(ILogger logger) : private static string GetLibraryName(Guid seriesId) { - return seriesId == Guid.Empty - ? "Unknown" - : Plugin.Instance?.GetItem(seriesId)?.GetTopParent()?.Name ?? "Unknown"; + if (seriesId == Guid.Empty) + { + return "Unknown"; + } + + var collectionFolders = Plugin.Instance?.GetCollectionFolders(seriesId); + return collectionFolders?.Count > 0 + ? string.Join(", ", collectionFolders.Select(folder => folder.Name)) + : "Unknown"; } } diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/Plugin.cs b/ConfusedPolarBear.Plugin.IntroSkipper/Plugin.cs index fc6532c..dae580e 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/Plugin.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/Plugin.cs @@ -358,6 +358,12 @@ public partial class Plugin : BasePlugin, IHasWebPages return _libraryManager.GetItemById(id); } + internal List GetCollectionFolders(Guid id) + { + var item = GetItem(id); + return item is not null ? _libraryManager.GetCollectionFolders(item) : []; + } + /// /// Gets the full path for an item. ///