aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Controller
diff options
context:
space:
mode:
authorJPVenson <6794763+JPVenson@users.noreply.github.com>2024-10-09 09:53:39 +0000
committerJPVenson <6794763+JPVenson@users.noreply.github.com>2024-10-09 09:53:39 +0000
commitbe48cdd9e90ed147c5526ef3fed0624bcbad7741 (patch)
tree54a05b60693c7e2fd66bd082e3606ac9d25ac800 /MediaBrowser.Controller
parent15bf43e3adc69fc0ec5413e81a20b1f0d5dccd5c (diff)
Naming refactoring and WIP porting of new interface repositories
Diffstat (limited to 'MediaBrowser.Controller')
-rw-r--r--MediaBrowser.Controller/Chapters/ChapterManager.cs24
-rw-r--r--MediaBrowser.Controller/Chapters/IChapterManager.cs35
-rw-r--r--MediaBrowser.Controller/Chapters/IChapterRepository.cs49
-rw-r--r--MediaBrowser.Controller/Drawing/IImageProcessor.cs25
-rw-r--r--MediaBrowser.Controller/Entities/BaseItem.cs7
-rw-r--r--MediaBrowser.Controller/Persistence/IItemRepository.cs1
-rw-r--r--MediaBrowser.Controller/Persistence/IItemTypeLookup.cs57
-rw-r--r--MediaBrowser.Controller/Persistence/IMediaAttachmentRepository.cs (renamed from MediaBrowser.Controller/Persistence/IMediaAttachmentManager.cs)3
-rw-r--r--MediaBrowser.Controller/Persistence/IMediaStreamRepository.cs (renamed from MediaBrowser.Controller/Persistence/IMediaStreamManager.cs)7
-rw-r--r--MediaBrowser.Controller/Persistence/IPeopleRepository.cs (renamed from MediaBrowser.Controller/Persistence/IPeopleManager.cs)3
10 files changed, 143 insertions, 68 deletions
diff --git a/MediaBrowser.Controller/Chapters/ChapterManager.cs b/MediaBrowser.Controller/Chapters/ChapterManager.cs
deleted file mode 100644
index a9e11f603..000000000
--- a/MediaBrowser.Controller/Chapters/ChapterManager.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-#pragma warning disable CS1591
-
-using System;
-using System.Collections.Generic;
-using MediaBrowser.Controller.Chapters;
-using MediaBrowser.Controller.Persistence;
-using MediaBrowser.Model.Entities;
-
-namespace MediaBrowser.Providers.Chapters
-{
- public class ChapterManager : IChapterManager
- {
- public ChapterManager(IDbContextFactory<JellyfinDbContext> dbProvider)
- {
- _itemRepo = itemRepo;
- }
-
- /// <inheritdoc />
- public void SaveChapters(Guid itemId, IReadOnlyList<ChapterInfo> chapters)
- {
- _itemRepo.SaveChapters(itemId, chapters);
- }
- }
-}
diff --git a/MediaBrowser.Controller/Chapters/IChapterManager.cs b/MediaBrowser.Controller/Chapters/IChapterManager.cs
deleted file mode 100644
index 55762c7fc..000000000
--- a/MediaBrowser.Controller/Chapters/IChapterManager.cs
+++ /dev/null
@@ -1,35 +0,0 @@
-using System;
-using System.Collections.Generic;
-using MediaBrowser.Model.Dto;
-using MediaBrowser.Model.Entities;
-
-namespace MediaBrowser.Controller.Chapters
-{
- /// <summary>
- /// Interface IChapterManager.
- /// </summary>
- public interface IChapterManager
- {
- /// <summary>
- /// Saves the chapters.
- /// </summary>
- /// <param name="itemId">The item.</param>
- /// <param name="chapters">The set of chapters.</param>
- void SaveChapters(Guid itemId, IReadOnlyList<ChapterInfo> chapters);
-
- /// <summary>
- /// Gets all chapters associated with the baseItem.
- /// </summary>
- /// <param name="baseItem">The baseitem.</param>
- /// <returns>A readonly list of chapter instances.</returns>
- IReadOnlyList<ChapterInfo> GetChapters(BaseItemDto baseItem);
-
- /// <summary>
- /// Gets a single chapter of a BaseItem on a specific index.
- /// </summary>
- /// <param name="baseItem">The baseitem.</param>
- /// <param name="index">The index of that chapter.</param>
- /// <returns>A chapter instance.</returns>
- ChapterInfo? GetChapter(BaseItemDto baseItem, int index);
- }
-}
diff --git a/MediaBrowser.Controller/Chapters/IChapterRepository.cs b/MediaBrowser.Controller/Chapters/IChapterRepository.cs
new file mode 100644
index 000000000..e22cb0f58
--- /dev/null
+++ b/MediaBrowser.Controller/Chapters/IChapterRepository.cs
@@ -0,0 +1,49 @@
+using System;
+using System.Collections.Generic;
+using MediaBrowser.Model.Dto;
+using MediaBrowser.Model.Entities;
+
+namespace MediaBrowser.Controller.Chapters;
+
+/// <summary>
+/// Interface IChapterManager.
+/// </summary>
+public interface IChapterRepository
+{
+ /// <summary>
+ /// Saves the chapters.
+ /// </summary>
+ /// <param name="itemId">The item.</param>
+ /// <param name="chapters">The set of chapters.</param>
+ void SaveChapters(Guid itemId, IReadOnlyList<ChapterInfo> chapters);
+
+ /// <summary>
+ /// Gets all chapters associated with the baseItem.
+ /// </summary>
+ /// <param name="baseItem">The baseitem.</param>
+ /// <returns>A readonly list of chapter instances.</returns>
+ IReadOnlyList<ChapterInfo> GetChapters(BaseItemDto baseItem);
+
+ /// <summary>
+ /// Gets a single chapter of a BaseItem on a specific index.
+ /// </summary>
+ /// <param name="baseItem">The baseitem.</param>
+ /// <param name="index">The index of that chapter.</param>
+ /// <returns>A chapter instance.</returns>
+ ChapterInfo? GetChapter(BaseItemDto baseItem, int index);
+
+ /// <summary>
+ /// Gets all chapters associated with the baseItem.
+ /// </summary>
+ /// <param name="baseItemId">The BaseItems id.</param>
+ /// <returns>A readonly list of chapter instances.</returns>
+ IReadOnlyList<ChapterInfo> GetChapters(Guid baseItemId);
+
+ /// <summary>
+ /// Gets a single chapter of a BaseItem on a specific index.
+ /// </summary>
+ /// <param name="baseItemId">The BaseItems id.</param>
+ /// <param name="index">The index of that chapter.</param>
+ /// <returns>A chapter instance.</returns>
+ ChapterInfo? GetChapter(Guid baseItemId, int index);
+}
diff --git a/MediaBrowser.Controller/Drawing/IImageProcessor.cs b/MediaBrowser.Controller/Drawing/IImageProcessor.cs
index 0d1e2a5a0..702ce39a2 100644
--- a/MediaBrowser.Controller/Drawing/IImageProcessor.cs
+++ b/MediaBrowser.Controller/Drawing/IImageProcessor.cs
@@ -6,6 +6,7 @@ using System.Threading.Tasks;
using Jellyfin.Data.Entities;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Model.Drawing;
+using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
namespace MediaBrowser.Controller.Drawing
@@ -60,11 +61,35 @@ namespace MediaBrowser.Controller.Drawing
/// <summary>
/// Gets the image cache tag.
/// </summary>
+ /// <param name="baseItemPath">The items basePath.</param>
+ /// <param name="imageDateModified">The image last modification date.</param>
+ /// <returns>Guid.</returns>
+ string? GetImageCacheTag(string baseItemPath, DateTime imageDateModified);
+
+ /// <summary>
+ /// Gets the image cache tag.
+ /// </summary>
+ /// <param name="item">The item.</param>
+ /// <param name="image">The image.</param>
+ /// <returns>Guid.</returns>
+ string? GetImageCacheTag(BaseItemDto item, ChapterInfo image);
+
+ /// <summary>
+ /// Gets the image cache tag.
+ /// </summary>
/// <param name="item">The item.</param>
/// <param name="image">The image.</param>
/// <returns>Guid.</returns>
string GetImageCacheTag(BaseItem item, ItemImageInfo image);
+ /// <summary>
+ /// Gets the image cache tag.
+ /// </summary>
+ /// <param name="item">The item.</param>
+ /// <param name="image">The image.</param>
+ /// <returns>Guid.</returns>
+ string GetImageCacheTag(BaseItemDto item, ItemImageInfo image);
+
string? GetImageCacheTag(BaseItem item, ChapterInfo chapter);
string? GetImageCacheTag(User user);
diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs
index eb605f6c8..a4764dd33 100644
--- a/MediaBrowser.Controller/Entities/BaseItem.cs
+++ b/MediaBrowser.Controller/Entities/BaseItem.cs
@@ -16,6 +16,7 @@ using Jellyfin.Data.Enums;
using Jellyfin.Extensions;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Channels;
+using MediaBrowser.Controller.Chapters;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities.Audio;
@@ -479,6 +480,8 @@ namespace MediaBrowser.Controller.Entities
public static IItemRepository ItemRepository { get; set; }
+ public static IChapterRepository ChapterRepository { get; set; }
+
public static IFileSystem FileSystem { get; set; }
public static IUserDataManager UserDataManager { get; set; }
@@ -2031,7 +2034,7 @@ namespace MediaBrowser.Controller.Entities
{
if (imageType == ImageType.Chapter)
{
- var chapter = ItemRepository.GetChapter(this, imageIndex);
+ var chapter = ChapterRepository.GetChapter(this.Id, imageIndex);
if (chapter is null)
{
@@ -2081,7 +2084,7 @@ namespace MediaBrowser.Controller.Entities
if (image.Type == ImageType.Chapter)
{
- var chapters = ItemRepository.GetChapters(this);
+ var chapters = ChapterRepository.GetChapters(this.Id);
for (var i = 0; i < chapters.Count; i++)
{
if (chapters[i].ImagePath == image.Path)
diff --git a/MediaBrowser.Controller/Persistence/IItemRepository.cs b/MediaBrowser.Controller/Persistence/IItemRepository.cs
index 313b1459a..b27f156ef 100644
--- a/MediaBrowser.Controller/Persistence/IItemRepository.cs
+++ b/MediaBrowser.Controller/Persistence/IItemRepository.cs
@@ -52,7 +52,6 @@ public interface IItemRepository : IDisposable
/// <returns>List&lt;Guid&gt;.</returns>
IReadOnlyList<Guid> GetItemIdsList(InternalItemsQuery filter);
-
/// <summary>
/// Gets the item list.
/// </summary>
diff --git a/MediaBrowser.Controller/Persistence/IItemTypeLookup.cs b/MediaBrowser.Controller/Persistence/IItemTypeLookup.cs
new file mode 100644
index 000000000..1b2ca2acb
--- /dev/null
+++ b/MediaBrowser.Controller/Persistence/IItemTypeLookup.cs
@@ -0,0 +1,57 @@
+using System;
+using System.Collections.Generic;
+using Jellyfin.Data.Enums;
+using MediaBrowser.Model.Querying;
+
+namespace MediaBrowser.Controller.Persistence;
+
+/// <summary>
+/// Provides static lookup data for <see cref="ItemFields"/> and <see cref="BaseItemKind"/> for the domain.
+/// </summary>
+public interface IItemTypeLookup
+{
+ /// <summary>
+ /// Gets all values of the ItemFields type.
+ /// </summary>
+ public IReadOnlyList<ItemFields> AllItemFields { get; }
+
+ /// <summary>
+ /// Gets all BaseItemKinds that are considered Programs.
+ /// </summary>
+ public IReadOnlyList<BaseItemKind> ProgramTypes { get; }
+
+ /// <summary>
+ /// Gets all BaseItemKinds that should be excluded from parent lookup.
+ /// </summary>
+ public IReadOnlyList<BaseItemKind> ProgramExcludeParentTypes { get; }
+
+ /// <summary>
+ /// Gets all BaseItemKinds that are considered to be provided by services.
+ /// </summary>
+ public IReadOnlyList<BaseItemKind> ServiceTypes { get; }
+
+ /// <summary>
+ /// Gets all BaseItemKinds that have a StartDate.
+ /// </summary>
+ public IReadOnlyList<BaseItemKind> StartDateTypes { get; }
+
+ /// <summary>
+ /// Gets all BaseItemKinds that are considered Series.
+ /// </summary>
+ public IReadOnlyList<BaseItemKind> SeriesTypes { get; }
+
+ /// <summary>
+ /// Gets all BaseItemKinds that are not to be evaluated for Artists.
+ /// </summary>
+ public IReadOnlyList<BaseItemKind> ArtistExcludeParentTypes { get; }
+
+ /// <summary>
+ /// Gets all BaseItemKinds that are considered Artists.
+ /// </summary>
+ public IReadOnlyList<BaseItemKind> ArtistsTypes { get; }
+
+ /// <summary>
+ /// Gets mapping for all BaseItemKinds and their expected serialisaition target.
+ /// </summary>
+ public IDictionary<BaseItemKind, string?> BaseItemKindNames { get; }
+}
diff --git a/MediaBrowser.Controller/Persistence/IMediaAttachmentManager.cs b/MediaBrowser.Controller/Persistence/IMediaAttachmentRepository.cs
index 210d80afa..4773f4058 100644
--- a/MediaBrowser.Controller/Persistence/IMediaAttachmentManager.cs
+++ b/MediaBrowser.Controller/Persistence/IMediaAttachmentRepository.cs
@@ -9,9 +9,8 @@ using MediaBrowser.Model.Entities;
namespace MediaBrowser.Controller.Persistence;
-public interface IMediaAttachmentManager
+public interface IMediaAttachmentRepository
{
-
/// <summary>
/// Gets the media attachments.
/// </summary>
diff --git a/MediaBrowser.Controller/Persistence/IMediaStreamManager.cs b/MediaBrowser.Controller/Persistence/IMediaStreamRepository.cs
index ec7c72935..665129eaf 100644
--- a/MediaBrowser.Controller/Persistence/IMediaStreamManager.cs
+++ b/MediaBrowser.Controller/Persistence/IMediaStreamRepository.cs
@@ -9,14 +9,17 @@ using MediaBrowser.Model.Entities;
namespace MediaBrowser.Controller.Persistence;
-public interface IMediaStreamManager
+/// <summary>
+/// Provides methods for accessing MediaStreams.
+/// </summary>
+public interface IMediaStreamRepository
{
/// <summary>
/// Gets the media streams.
/// </summary>
/// <param name="filter">The query.</param>
/// <returns>IEnumerable{MediaStream}.</returns>
- List<MediaStream> GetMediaStreams(MediaStreamQuery filter);
+ IReadOnlyList<MediaStream> GetMediaStreams(MediaStreamQuery filter);
/// <summary>
/// Saves the media streams.
diff --git a/MediaBrowser.Controller/Persistence/IPeopleManager.cs b/MediaBrowser.Controller/Persistence/IPeopleRepository.cs
index 84e503fef..43a24703e 100644
--- a/MediaBrowser.Controller/Persistence/IPeopleManager.cs
+++ b/MediaBrowser.Controller/Persistence/IPeopleRepository.cs
@@ -8,7 +8,7 @@ using MediaBrowser.Controller.Entities;
namespace MediaBrowser.Controller.Persistence;
-public interface IPeopleManager
+public interface IPeopleRepository
{
/// <summary>
/// Gets the people.
@@ -30,5 +30,4 @@ public interface IPeopleManager
/// <param name="filter">The query.</param>
/// <returns>List&lt;System.String&gt;.</returns>
IReadOnlyList<string> GetPeopleNames(InternalPeopleQuery filter);
-
}