aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller/Entities/Person.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Controller/Entities/Person.cs')
-rw-r--r--MediaBrowser.Controller/Entities/Person.cs38
1 files changed, 38 insertions, 0 deletions
diff --git a/MediaBrowser.Controller/Entities/Person.cs b/MediaBrowser.Controller/Entities/Person.cs
index 5cc4d322f..d4158655b 100644
--- a/MediaBrowser.Controller/Entities/Person.cs
+++ b/MediaBrowser.Controller/Entities/Person.cs
@@ -5,6 +5,7 @@
using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
+using Jellyfin.Data.Enums;
using Jellyfin.Extensions;
using MediaBrowser.Controller.Providers;
using Microsoft.Extensions.Logging;
@@ -70,6 +71,43 @@ namespace MediaBrowser.Controller.Entities
return LibraryManager.GetItemList(query);
}
+ public TaggedItemCounts GetTaggedItemCounts(InternalItemsQuery query)
+ {
+ query.PersonIds = [Id];
+
+ var counts = new TaggedItemCounts();
+
+ // TODO: Remove MusicAlbum and MusicArtist when the relationship between Persons and Music is removed
+ query.IncludeItemTypes = [BaseItemKind.MusicAlbum];
+ counts.AlbumCount = LibraryManager.GetCount(query);
+
+ query.IncludeItemTypes = [BaseItemKind.MusicArtist];
+ counts.ArtistCount = LibraryManager.GetCount(query);
+
+ query.IncludeItemTypes = [BaseItemKind.Episode];
+ counts.EpisodeCount = LibraryManager.GetCount(query);
+
+ query.IncludeItemTypes = [BaseItemKind.Movie];
+ counts.MovieCount = LibraryManager.GetCount(query);
+
+ query.IncludeItemTypes = [BaseItemKind.MusicVideo];
+ counts.MusicVideoCount = LibraryManager.GetCount(query);
+
+ query.IncludeItemTypes = [BaseItemKind.LiveTvProgram];
+ counts.ProgramCount = LibraryManager.GetCount(query);
+
+ query.IncludeItemTypes = [BaseItemKind.Series];
+ counts.SeriesCount = LibraryManager.GetCount(query);
+
+ query.IncludeItemTypes = [BaseItemKind.Audio];
+ counts.SongCount = LibraryManager.GetCount(query);
+
+ query.IncludeItemTypes = [BaseItemKind.Trailer];
+ counts.TrailerCount = LibraryManager.GetCount(query);
+
+ return counts;
+ }
+
public override bool CanDelete()
{
return false;