From be48cdd9e90ed147c5526ef3fed0624bcbad7741 Mon Sep 17 00:00:00 2001
From: JPVenson <6794763+JPVenson@users.noreply.github.com>
Date: Wed, 9 Oct 2024 09:53:39 +0000
Subject: Naming refactoring and WIP porting of new interface repositories
---
Emby.Server.Implementations/Data/ItemTypeLookup.cs | 139 +++++++++++++++++++++
1 file changed, 139 insertions(+)
create mode 100644 Emby.Server.Implementations/Data/ItemTypeLookup.cs
(limited to 'Emby.Server.Implementations/Data')
diff --git a/Emby.Server.Implementations/Data/ItemTypeLookup.cs b/Emby.Server.Implementations/Data/ItemTypeLookup.cs
new file mode 100644
index 000000000..14dc68a32
--- /dev/null
+++ b/Emby.Server.Implementations/Data/ItemTypeLookup.cs
@@ -0,0 +1,139 @@
+using System;
+using System.Collections.Generic;
+using System.Threading.Channels;
+using Emby.Server.Implementations.Playlists;
+using Jellyfin.Data.Enums;
+using MediaBrowser.Controller.Entities;
+using MediaBrowser.Controller.Entities.Audio;
+using MediaBrowser.Controller.Entities.Movies;
+using MediaBrowser.Controller.Entities.TV;
+using MediaBrowser.Controller.LiveTv;
+using MediaBrowser.Controller.Persistence;
+using MediaBrowser.Controller.Playlists;
+using MediaBrowser.Model.Querying;
+
+namespace Jellyfin.Server.Implementations.Item;
+
+///
+/// Provides static topic based lookups for the BaseItemKind.
+///
+public class ItemTypeLookup : IItemTypeLookup
+{
+ ///
+ /// Gets all values of the ItemFields type.
+ ///
+ public IReadOnlyList AllItemFields { get; } = Enum.GetValues();
+
+ ///
+ /// Gets all BaseItemKinds that are considered Programs.
+ ///
+ public IReadOnlyList ProgramTypes { get; } =
+ [
+ BaseItemKind.Program,
+ BaseItemKind.TvChannel,
+ BaseItemKind.LiveTvProgram,
+ BaseItemKind.LiveTvChannel
+ ];
+
+ ///
+ /// Gets all BaseItemKinds that should be excluded from parent lookup.
+ ///
+ public IReadOnlyList ProgramExcludeParentTypes { get; } =
+ [
+ BaseItemKind.Series,
+ BaseItemKind.Season,
+ BaseItemKind.MusicAlbum,
+ BaseItemKind.MusicArtist,
+ BaseItemKind.PhotoAlbum
+ ];
+
+ ///
+ /// Gets all BaseItemKinds that are considered to be provided by services.
+ ///
+ public IReadOnlyList ServiceTypes { get; } =
+ [
+ BaseItemKind.TvChannel,
+ BaseItemKind.LiveTvChannel
+ ];
+
+ ///
+ /// Gets all BaseItemKinds that have a StartDate.
+ ///
+ public IReadOnlyList StartDateTypes { get; } =
+ [
+ BaseItemKind.Program,
+ BaseItemKind.LiveTvProgram
+ ];
+
+ ///
+ /// Gets all BaseItemKinds that are considered Series.
+ ///
+ public IReadOnlyList SeriesTypes { get; } =
+ [
+ BaseItemKind.Book,
+ BaseItemKind.AudioBook,
+ BaseItemKind.Episode,
+ BaseItemKind.Season
+ ];
+
+ ///
+ /// Gets all BaseItemKinds that are not to be evaluated for Artists.
+ ///
+ public IReadOnlyList ArtistExcludeParentTypes { get; } =
+ [
+ BaseItemKind.Series,
+ BaseItemKind.Season,
+ BaseItemKind.PhotoAlbum
+ ];
+
+ ///
+ /// Gets all BaseItemKinds that are considered Artists.
+ ///
+ public IReadOnlyList ArtistsTypes { get; } =
+ [
+ BaseItemKind.Audio,
+ BaseItemKind.MusicAlbum,
+ BaseItemKind.MusicVideo,
+ BaseItemKind.AudioBook
+ ];
+
+ ///
+ /// Gets mapping for all BaseItemKinds and their expected serialisaition target.
+ ///
+ public IDictionary BaseItemKindNames { get; } = new Dictionary()
+ {
+ { BaseItemKind.AggregateFolder, typeof(AggregateFolder).FullName },
+ { BaseItemKind.Audio, typeof(Audio).FullName },
+ { BaseItemKind.AudioBook, typeof(AudioBook).FullName },
+ { BaseItemKind.BasePluginFolder, typeof(BasePluginFolder).FullName },
+ { BaseItemKind.Book, typeof(Book).FullName },
+ { BaseItemKind.BoxSet, typeof(BoxSet).FullName },
+ { BaseItemKind.Channel, typeof(Channel).FullName },
+ { BaseItemKind.CollectionFolder, typeof(CollectionFolder).FullName },
+ { BaseItemKind.Episode, typeof(Episode).FullName },
+ { BaseItemKind.Folder, typeof(Folder).FullName },
+ { BaseItemKind.Genre, typeof(Genre).FullName },
+ { BaseItemKind.Movie, typeof(Movie).FullName },
+ { BaseItemKind.LiveTvChannel, typeof(LiveTvChannel).FullName },
+ { BaseItemKind.LiveTvProgram, typeof(LiveTvProgram).FullName },
+ { BaseItemKind.MusicAlbum, typeof(MusicAlbum).FullName },
+ { BaseItemKind.MusicArtist, typeof(MusicArtist).FullName },
+ { BaseItemKind.MusicGenre, typeof(MusicGenre).FullName },
+ { BaseItemKind.MusicVideo, typeof(MusicVideo).FullName },
+ { BaseItemKind.Person, typeof(Person).FullName },
+ { BaseItemKind.Photo, typeof(Photo).FullName },
+ { BaseItemKind.PhotoAlbum, typeof(PhotoAlbum).FullName },
+ { BaseItemKind.Playlist, typeof(Playlist).FullName },
+ { BaseItemKind.PlaylistsFolder, typeof(PlaylistsFolder).FullName },
+ { BaseItemKind.Season, typeof(Season).FullName },
+ { BaseItemKind.Series, typeof(Series).FullName },
+ { BaseItemKind.Studio, typeof(Studio).FullName },
+ { BaseItemKind.Trailer, typeof(Trailer).FullName },
+ { BaseItemKind.TvChannel, typeof(LiveTvChannel).FullName },
+ { BaseItemKind.TvProgram, typeof(LiveTvProgram).FullName },
+ { BaseItemKind.UserRootFolder, typeof(UserRootFolder).FullName },
+ { BaseItemKind.UserView, typeof(UserView).FullName },
+ { BaseItemKind.Video, typeof(Video).FullName },
+ { BaseItemKind.Year, typeof(Year).FullName }
+ }.AsReadOnly();
+}
--
cgit v1.2.3