Naming refactoring and WIP porting of new interface repositories

This commit is contained in:
JPVenson
2024-10-09 09:53:39 +00:00
parent 15bf43e3ad
commit be48cdd9e9
32 changed files with 601 additions and 367 deletions

View File

@@ -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);
}
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}

View File

@@ -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
@@ -57,6 +58,22 @@ namespace MediaBrowser.Controller.Drawing
/// <returns>BlurHash.</returns>
string GetImageBlurHash(string path, ImageDimensions imageDimensions);
/// <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>
@@ -65,6 +82,14 @@ namespace MediaBrowser.Controller.Drawing
/// <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);

View File

@@ -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)

View File

@@ -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>

View File

@@ -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; }
}

View File

@@ -9,9 +9,8 @@ using MediaBrowser.Model.Entities;
namespace MediaBrowser.Controller.Persistence;
public interface IMediaAttachmentManager
public interface IMediaAttachmentRepository
{
/// <summary>
/// Gets the media attachments.
/// </summary>

View File

@@ -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.

View File

@@ -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);
}