use correct library name (#301)

Co-authored-by: rlauu <46294892+rlauu@users.noreply.github.com>
This commit is contained in:
rlauuzo 2024-09-21 20:12:00 +02:00 committed by GitHub
parent 9f72647591
commit e829f52acc
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 3 deletions

View File

@ -302,8 +302,14 @@ public class VisualizationController(ILogger<VisualizationController> logger) :
private static string GetLibraryName(Guid seriesId) private static string GetLibraryName(Guid seriesId)
{ {
return seriesId == Guid.Empty if (seriesId == Guid.Empty)
? "Unknown" {
: Plugin.Instance?.GetItem(seriesId)?.GetTopParent()?.Name ?? "Unknown"; return "Unknown";
}
var collectionFolders = Plugin.Instance?.GetCollectionFolders(seriesId);
return collectionFolders?.Count > 0
? string.Join(", ", collectionFolders.Select(folder => folder.Name))
: "Unknown";
} }
} }

View File

@ -358,6 +358,12 @@ public partial class Plugin : BasePlugin<PluginConfiguration>, IHasWebPages
return _libraryManager.GetItemById(id); return _libraryManager.GetItemById(id);
} }
internal List<Folder> GetCollectionFolders(Guid id)
{
var item = GetItem(id);
return item is not null ? _libraryManager.GetCollectionFolders(item) : [];
}
/// <summary> /// <summary>
/// Gets the full path for an item. /// Gets the full path for an item.
/// </summary> /// </summary>