diff options
Diffstat (limited to 'MediaBrowser.Controller/Entities/Year.cs')
| -rw-r--r-- | MediaBrowser.Controller/Entities/Year.cs | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/MediaBrowser.Controller/Entities/Year.cs b/MediaBrowser.Controller/Entities/Year.cs index 37820296c..a1ff9f4d4 100644 --- a/MediaBrowser.Controller/Entities/Year.cs +++ b/MediaBrowser.Controller/Entities/Year.cs @@ -6,6 +6,7 @@ using System; using System.Collections.Generic; using System.Globalization; using System.Text.Json.Serialization; +using Jellyfin.Data.Enums; using Microsoft.Extensions.Logging; namespace MediaBrowser.Controller.Entities @@ -68,6 +69,47 @@ namespace MediaBrowser.Controller.Entities return LibraryManager.GetItemList(query); } + public TaggedItemCounts GetTaggedItemCounts(InternalItemsQuery query) + { + if (!int.TryParse(Name, NumberStyles.Integer, CultureInfo.InvariantCulture, out var year)) + { + return new TaggedItemCounts(); + } + + query.Years = [year]; + + var counts = new TaggedItemCounts(); + + 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 int? GetYearValue() { if (int.TryParse(Name, NumberStyles.Integer, CultureInfo.InvariantCulture, out var year)) |
